41 ms·
If it's a complex query of some sort, create a query repository that returns model objects rather than a "fat" static method on the model itself. I believe tha
by ldite 13y ago
If it's a complex query of some sort, create a query repository that returns model objects rather than a "fat" static method on the model itself.
I believe that the "Django way" of doing that is to have a custom "Manager" class;
https://docs.djangoproject.com/en/1.6/topics/db/managers/#custom-managers-and-model-inheritance https://docs.djangoproject.com/en/1.6/topics/db/managers/#cu...
http://zmsmith.com/2010/04/using-custom-django-querysets/ http://zmsmith.com/2010/04/using-custom-django-querysets/