#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

Change History (1)

comment:1 Changed 19 months ago by bmispelon

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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_set methods have been renamed to get_queryset for consistency.

Note: See TracTickets for help on using tickets.
Back to Top