Enes
isnt wrtr.save exactly what does
Enes
does it get saved into the DB?
As I know .save method saves to db
Enes
Maybe this is because for working comfortable with models.Manager
Д
As I know .save method saves to db
the new field hasn't been migrated at least. hmm. not sure where or how django decides what fields it saves.
Д
because if it tried to save a non-existent field into the DB, surely there would be an exception
Enes
yes that is why I suprised
Д
maybe it doesn't save it because it doesn't have the correct datatype. the normal fields are all some kind of Django-inherited fields. that's just a normal Class str
Д
what happens if you try to add some new IntegerField
Enes
what happens if you try to add some new IntegerField
Samething happens. I even add a tr and int field with that
Enes
ops underscore underscore
Enes
the object is saving but non exist fields doesnt seems
Д
I think it's normal that you can add things to models
Д
because you have to be able to do things with models
Enes
I have changed --str-- in shell and saved normally but in admin it is still returning old str function value
Enes
because you have to be able to do things with models
yeah I agree. It didn't raise any error. If it would also models.Manager classes would raise error
Enes
or proxy models
Enes
But I was don't know that we can add non-exist fields without specify that this object is Proxy
Д
I'm still not sure when to carry data around in Django Models and when not
Д
because they are Django-specific so it feels 'dirty' to use them
Д
does it make sense to use my DB model elsewhere in my program?
Enes
You don't need to create 3 different django models called normal user, premium user, vip user with have the same 15 fields. Instead of creating 3 different models you can create one model and you can inherit from that one and as a field you can put only which field you want to change. As an example premium user have to buy with 25% off. vip 30% off
Enes
so you can use Manager model or proxy for situation
Enes
This will create performance and block huge db in big projects
Д
You don't need to create 3 different django models called normal user, premium user, vip user with have the same 15 fields. Instead of creating 3 different models you can create one model and you can inherit from that one and as a field you can put only which field you want to change. As an example premium user have to buy with 25% off. vip 30% off
I'm wondering about this more from the point of view where the Application logic (not only Business logic) would start overflowing from the simple Django stuff. I've been mostly using Django through DRF. No template stuff for me, only API stuff and then Javascript. I'm trying to come up with an example.
Enes
this event is be around models.py
bellow of your exact model
Д
It is nice to see someone that works on only DRF
I don't need the templates because it's easier to create things with React, and do the whole website with that
Д
I just need the proper APIs
Enes
I have an issue with obtaining auth token in rest
Enes
I don't need the templates because it's easier to create things with React, and do the whole website with that
you do better. Template staffs for frontend developers. If your api is strong and secure we don't care about template
Enes
the front end developer will put interested loops to the template i think they should know at least that much
Enes
do you have any idea
QAM
Hi, any idea how i can create availability of sercive date in django
Enes
Hi, any idea how i can create availability of sercive date in django
if service date is the posted time. use timezone.now()
Enes
or you can add auto_now_add=True into your service dste field in model
Artur
who worked with stripe, tell me what is the name of the event that comes when the payment failed? when the payment has passed checkout.session.completed is called. and when not passed, then what event is called?
Hian
has anyone used select2 by ajax in django admin?
Enes
you need to take s look the stripe example app from GitHub
rtg
Hi! How can I use that?
rtg
return redirect(url 'scada_app:detail_scada')
rtg
(has error)
Doragonsureiyā
(has error)
Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain: - what you're doing - what you're expecting - what you're using - where you're running the script - what Python version you're using - what packages and their versions you're using - and the most important thing: show the code YOU wrote (read rule 5️⃣ for that) and more details, that way your chances to get help will increase
rtg
When i am in def how can i redirect to an url?
Ali
Hi, Is it possible to run a Django project on Oracle's Cloud Free Tier?
Ali
I've seen it's being told as a VPS. Since it's possible to run a Django project on virtual private sevices, I want to make sure if it'll make troubles.
Sarthak
if 'search_query' in request.GET: search_query = request.GET['search_query'] all_patient_list = Patient.objects.filter (Q(name__icontains=search_query) | Q(phone__icontains=search_query) | Q(email__icontains=search_query) | Q(age__icontains=search_query) | Q(gender__icontains=search_query)| Q(note__icontains=search_query)).order_by('-created_at') i'm getting this error please give a solution i'm stuck....
Sarthak
Q object has no attribute 'order_by'
Saddam
How to retrive data from two models in one form? Did any now.... For example in model 1) has name, gmail and in model 2) has complete profile details now I want fetch two model details in single html page based on id... it is possible without foreign key?
(⌐■-■)
Make 2 different objects for the models and send data through contexts
Aleksey
Hi, everyone! Can you help me with that question(s). I'm the OP. https://stackoverflow.com/questions/71611273/django-dockerfile-the-difference-between-linux-run-build-dependencies
Anonymous
How to implement field level permission in Django rest framework?
Mika
Field level such as .add .edit?
Shazeb
https://linkode.org/#vusnoY1v8ANuBHn7exIIB5
Shazeb
can someone help now please?
Sarah
Apart from aws which other platform can I use for database and static files. Which is not expensive
Sayidbek
hello there, i am doing git push heroku master, but it's saying Please make sure you have the correct access rights and the repository exists.
Sayidbek
Any help is welcome
Happy days
in your settings.py file add your other app's directory to it
I mentioned it in settings.py but I don't know that how to render the second app's HTML file from first app's views function.
Enes
I mentioned it in settings.py but I don't know that how to render the second app's HTML file from first app's views function.
you need to write your directory path in settings and in views just define like you do in your project templates. I suggest you to watch a tutorial about connecting django to reactjs you will see the action what the tutor adds and after you can edit this by yours
Krushna
I mentioned it in settings.py but I don't know that how to render the second app's HTML file from first app's views function.
I hope this is what you are looking for: https://stackoverflow.com/questions/34294183/django-view-render-to-template-from-another-app/34294554
Doragonsureiyā
hello there, i am doing git push heroku master, but it's saying Please make sure you have the correct access rights and the repository exists.
Your question is not related to Django. If it's a Python related question go to @Python group, otherwise please move to @PythonOfftopic group and ask there.
Vikash
@sayibdek this is showing because you try to push In existing repo
Ricardo
When it comes to validating a date type field, is it done from the backend or frontend?
Marline
Hi Can someone help with how I can delete data from a production database using a migration script in python
Anil
Does anyone preparing for data structures and algorithms in python. I am preparing for Google and Amazon interview and looking for head to head aggressive partner Please message me if anyone is interested. Thank you
Manish
Hi Can someone help with how I can delete data from a production database using a migration script in python
I would suggest don't use migration script, use management command and prepare a query test it over pre prod and then deploy the same on prod and run the management command from terminal
Packetero
def save(self): rates = coin_api.rates()["result"] if(self.currency in rates): self.fullname = rates[f"{self.currency}"]["name"] self.rate_btc = float(rates[f"{self.currency}"]["rate_btc"]) self.rate_usd = self.rate_btc / float(rates["USD"]["rate_btc"]) data.add(self) data.commit() return True else: return False def delete(self): data.delete(self) data.commit() Hello everyone how can I migrate this from sqlalchemy to Django?
🌀
Hey I am facing while executing script in django...can anyone help me please??
🌀
1. I'm trying to calculate amount from rate*qty 2. I'm expecting amount have to be different for different rows and will depend on quantity and rate 3. I'm using django-ide vs code 1.65.2 4. I'm running the script inside the html page 5. Python version 3.7.6