Opened 12 years ago
Closed 12 years ago
#21390 closed Bug (invalid)
Custom Manager Documentation Error
| Reported by: | m0nonoke | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 1.5 |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
The documentation for trunk has a section on modifying initial querysets for custom managers here;
https://docs.djangoproject.com/en/dev/topics/db/managers/#modifying-initial-manager-querysets
The code snippets and commentary as describe the hook as follows
class DahlBookManager(models.Manager):
def get_queryset(self):
return super(DahlBookManager, self).get_queryset().filter(author='Roald Dahl')
However this should be
class DahlBookManager(models.Manager):
def get_query_set(self):
return super(DahlBookManager, self).get_query_set().filter(author='Roald Dahl')
NB the get_query_set extra underscore
Note:
See TracTickets
for help on using tickets.
Hi,
This is a new feature of django 1.6: https://docs.djangoproject.com/en/dev/releases/1.6/#get-query-set-and-similar-methods-renamed-to-get-queryset
The various
get_query_setmethods have been renamed toget_querysetfor consistency.