summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLuke Plant <L.Plant.98@cantab.net>2014-10-02 11:19:18 +0100
committerLuke Plant <L.Plant.98@cantab.net>2014-10-02 11:35:59 +0100
commite71ef9b6f2d91b5863d7039cfefcea076611d552 (patch)
tree9473f075c372f488f00ab082d55616ef6ac9dae5 /docs
parent000415687323a7a7342eb2ec7e1bb1801613a652 (diff)
[1.6.x] Documented how to rename get_query_set if you are a library author
Backport of ca139bbfdf48bf59b0918a7d675cdc5d4ae60957 from master
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/1.6.txt20
1 files changed, 20 insertions, 0 deletions
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt
index 71dfd02b8b..c9da6735b7 100644
--- a/docs/releases/1.6.txt
+++ b/docs/releases/1.6.txt
@@ -1099,6 +1099,26 @@ a regular deprecation path.
Methods that return a ``QuerySet`` such as ``Manager.get_query_set`` or
``ModelAdmin.queryset`` have been renamed to ``get_queryset``.
+If you are writing a library that implements, for example, a
+``Manager.get_query_set`` method, and you need to support old Django versions,
+you should rename the method and conditionally add an alias with the old name::
+
+ class CustomManager(models.Manager):
+ def get_queryset(self):
+ pass # ...
+
+ if django.VERSION < (1, 6):
+ get_query_set = get_queryset
+
+ # For Django >= 1.6, models.Manager provides a get_query_set fallback
+ # that emits a warning when used.
+
+If you are writing a library that needs to call the ``get_queryset`` method and
+must support old Django versions, you should write::
+
+ method = getattr(some_manager, 'get_queryset', some_manager.get_query_set)
+ method(params)
+
``shortcut`` view and URLconf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~