Learn more about artificialintelligence with this collection
Find out the challenges it poses
Learn about the potential impact on society
Understanding the concept of Metaverse
The ".save()" method is used to write a model instance to the database. It can be an existing record or even a new one. For an existing record, Django will run a SQL UPDATE statement on the database. For a new record, Django will run an INSERT.
2
123 reads
When updating an existing record, Django will update every field. That means, if you changed only one field on the model instance, all the fields will be updated (with the values staying the same). This is inefficient, especially if the model has many fields.
Another problem is that if there's a significant amount of time in between the fetching of the record and the saving of it, it is possible that another request will have updated one of the fields on that record, and your model instance still has the old value.
Calling ".save()" now will overwrite the new value that someone else saved.
2
20 reads
To prevent updating every field of the model you can use the update_fields parameter. It expects a list of fields that you want to save. The UPDATE that is run against the database then only updates those fields that you have specified.
For example, in case we only want to update the price of a toy, we would run "toy.save(update_fields=["price"])".
2
25 reads
2
13 reads
The ".update()" method is available on each queryset object of the ORM. For example, "Toy.objects.filter(price__lt=50).update(price=50)".
This would update the price of all toys that are below a certain price. While this is for a range of records, it could also be used to update a single record: "Toy.objects.filter(name="hippo").update(price=120)".
2
11 reads
2
12 reads
More like this
2 ideas
PostgreSQL - How to Configure Slow Query Log
postgresql.org
1 idea
Foreign Key on Models | Django documentation
docs.djangoproject.com
5 ideas
Sanic and Data Validation using Pydantic
python.plainenglish.io
Explore the Worldβs
Best Ideas
Save ideas for later reading, for personalized stashes, or for remembering it later.
Start
31 ideas
Start
44 ideas
# Personal Growth
Take Your Ideas
Anywhere
Just press play and we take care of the words.
No Internet access? No problem. Within the mobile app, all your ideas are available, even when offline.
Ideas for your next work project? Quotes that inspire you? Put them in the right place so you never lose them.
Start
47 ideas
Start
75 ideas
My Stashes
Join
2 Million Stashers
4.8
5,740 Reviews
App Store
4.7
72,690 Reviews
Google Play
Sean Green
Great interesting short snippets of informative articles. Highly recommended to anyone who loves information and lacks patience.
β
Ashley Anthony
This app is LOADED with RELEVANT, HELPFUL, AND EDUCATIONAL material. It is creatively intellectual, yet minimal enough to not overstimulate and create a learning block. I am exceptionally impressed with this app!
β
Shankul Varada
Best app ever! You heard it right. This app has helped me get back on my quest to get things done while equipping myself with knowledge everyday.
β
samz905
Donβt look further if you love learning new things. A refreshing concept that provides quick ideas for busy thought leaders.
β
Giovanna Scalzone
Brilliant. It feels fresh and encouraging. So many interesting pieces of information that are just enough to absorb and apply. So happy I found this.
β
Ghazala Begum
Even five minutes a day will improve your thinking. I've come across new ideas and learnt to improve existing ways to become more motivated, confident and happier.
β
Jamyson Haug
Great for quick bits of information and interesting ideas around whatever topics you are interested in. Visually, it looks great as well.
β
Laetitia Berton
I have only been using it for a few days now, but I have found answers to questions I had never consciously formulated, or to problems I face everyday at work or at home. I wish I had found this earlier, highly recommended!
β
Read & Learn
20x Faster
without
deepstash
with
deepstash
with
deepstash
Access to 200,000+ ideas
β
Access to the mobile app
β
Unlimited idea saving & library
β
β
Unlimited history
β
β
Unlimited listening to ideas
β
β
Downloading & offline access
β
β
Personalized recommendations
β
β
Supercharge your mind with one idea per day
Enter your email and spend 1 minute every day to learn something new.
I agree to receive email updates