#23533: Hook for default QuerySet filtering defined on the QuerySet itself.
-------------------------------------+-------------------------------------
Reporter: loic | Owner: nobody
Type: New | Status: new
feature | Version: master
Component: Database | Keywords:
layer (models, ORM) | Has patch: 0
Severity: Normal | Needs tests: 0
Triage Stage: | Easy pickings: 0
Unreviewed |
Needs documentation: 0 |
Patch needs improvement: 0 |
UI/UX: 0 |
-------------------------------------+-------------------------------------
Django 1.7 brought managers automatically created from `QuerySet` which
replaces defining a custom manager for the purpose of defining reusable
methods. Refs #20625.
One use-case remains inelegant: using a custom `QuerySet` with default
`QuerySet` customization/filtering:
{{{
BaseCustomManager = Manager.from_queryset(CustomQueryset)
class CustomManager (BaseCustomManager ):
def get_queryset(self):
queryset = super(Manager, self).get_queryset()
return queryset.filter(...)
}}}
This ticket proposes adding a hook on `QuerySet` to enable this without
requiring a custom `Manager`.
--
Ticket URL: <https://code.djangoproject.com/ticket/23533>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/047.2bf4e488360256a8f314daa56a94ec00%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.