mirror of
https://github.com/django/django.git
synced 2025-03-12 10:22:37 +00:00
[1.8.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 f87e552d9842ff9591a9c51ebdb5f96e4dd54b00 from master
This commit is contained in:
parent
b252e0f350
commit
5e1fa14006
@ -1124,7 +1124,8 @@ a ``get_queryset_compat`` method as below and use it internally to your manager:
|
|||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return YourCustomQuerySet() # for example
|
return YourCustomQuerySet() # for example
|
||||||
|
|
||||||
get_query_set = get_queryset
|
if django.VERSION < (1, 6):
|
||||||
|
get_query_set = get_queryset
|
||||||
|
|
||||||
def active(self): # for example
|
def active(self): # for example
|
||||||
return self.get_queryset_compat().filter(active=True)
|
return self.get_queryset_compat().filter(active=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user