Feature Request: save() method for models
See original GitHub issueProblem: If I create new model and want to save it - I need to use await ModelClass.objects.create(column_name=model.column_name, ...)
.
Solution: Just call something like model.save()
the same way model.update()
is used right now. Also model.save()
can fallback to model.update()
if id is set.
Maybe I am missing something and there is another easy and clean way to add a new row, I am ready to use it or implement one.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Overriding the save method - Django Models - GeeksforGeeks
The save method is an inherited method from models.Model which is executed to save an instance into a particular Model.
Read more >django - How to access to request.user in def save() in models?
This object is linked to the user by a foreign key. I have override the def_save() method to create the user and link...
Read more >ability to save a tf.GraphModel to a local file system ... - GitHub
Currently you can load a tf.GraphModel with tf.loadGraphModel. Is there an easy way to save the files for the graph model locally?
Read more >Save and Load Machine Learning Models in Python with scikit ...
Save Your Model with joblib It provides utilities for saving and loading Python objects that make use of NumPy data structures, efficiently. ...
Read more >How to save a R model? - ProjectPro
This recipe helps you save a R model. ... method = 'anova'). Using rpart.plot() function to plot the decision tree model. rpart.plot(model) ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Instead of…
Use this…
If you really need to build it up gradually you can use this pattern…
Having partially populated model instances, or modifiying model instance properties directly is a problematic pattern and means that model instances don’t do a good job of encapsulating valid state changes.
Thanks, did not know that this is problematic pattern 😃