3 ms·
Best Practices Working with Django Models in Python
- coady 11y agoNice, a couple more recommendations: * Use update instead of get then save. It's shorter, faster, and safe from race conditions. * Use values{_list} instead of objects when only a few fields are required. Those two anti-patterns are so prevalent I created a package dedicated to discouraging them: https://pypi.python.org/pypi/django-model-values https://pypi.python.org/pypi/django-model-values.