> Example: Model.objects.get(), because nobody could understand Model.get(), right? /s
That has a simple explanation: each Model can have multiple Managers [1], and the `objects` is the default one. Also, by convention, methods on the Model are usually relative to "one DB record", and methods on the manager are relative to N records.
Thank you, I know now why Django inflicts that .objects method to everybody :-)
I'd rather design a less verbose API for the default manager
Model.get()
Model.filter()
...
and Model.manager.get() if one really needs custom managers.
The fact that I didn't know about managers after years of Django (and nobody told me) should be telling of me and my team, of course, but also how needed managers are. Having to go through that API without shortcuts is not nice to developers.
You're welcome. I'm probably biased because Django has been my framework of choice for more than 10 years, but I really like the distinction between methods relative to the Model and methods that act on multiple records and the `objects` thing doesn't bother me.
That has a simple explanation: each Model can have multiple Managers [1], and the `objects` is the default one. Also, by convention, methods on the Model are usually relative to "one DB record", and methods on the manager are relative to N records.
[1]: https://docs.djangoproject.com/en/2.2/topics/db/managers/