Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13951

Is there a robust way to automatically set update_fields when saving a model?

$
0
0

I've been having some issues with Django model saving and concurrency.

It seems unnecessary that every time you call .save() on a model it overwrites every field even if you're only intending to write one field. I can't think of a specific use case for why that would be the default behavior since it is safer for concurrency and more performant to only write the necessary fields.

I was thinking about expanding off of this thread to automatically determine which fields have been updated to specify update_fields (if they aren't already specified) accordingly in the save method.

Has anyone tried this? Am I overlooking something that will cause other issues?


Viewing all articles
Browse latest Browse all 13951

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>