[1.6.x] Corrected example code for get_query_set upgrade in 1.6 release notes

The conditional setting of `get_query_set` is required for correct behaviour
if running Django 1.8. The full gory details are here:

http://lukeplant.me.uk/blog/posts/handling-django%27s-get_query_set-rename-is-hard/

Backport of f87e552d98 from master
This commit is contained in:
Luke Plant 2015-07-08 10:58:07 +01:00
parent 019eaacefc
commit 4e26a84a12
1 changed files with 2 additions and 1 deletions

View File

@ -1133,7 +1133,8 @@ a ``get_queryset_compat`` method as below and use it internally to your manager:
def get_queryset(self):
return YourCustomQuerySet() # for example
get_query_set = get_queryset
if django.VERSION < (1, 6):
get_query_set = get_queryset
def active(self): # for example
return self.get_queryset_compat().filter(active=True)