diff options
| author | Luke Plant <L.Plant.98@cantab.net> | 2014-11-24 10:09:39 +0000 |
|---|---|---|
| committer | Luke Plant <L.Plant.98@cantab.net> | 2014-11-24 10:13:17 +0000 |
| commit | 1fa2e7aba1a4837eede4b5c0e4f9e14fdd413c6d (patch) | |
| tree | 4abcd828e60fb574a0a72e8a0bb6214dee1b7a6e | |
| parent | db227d9d20d848c56f94ce0ca175fde7e1180c21 (diff) | |
[1.6.x] Better migration docs for get_query_set -> get_queryset
This way they won't need to fix things again when get_query_set disappears
Backport of 91e2780dfba5609b0f83d51aee1cf7e8fe78b1f7 from master
| -rw-r--r-- | docs/releases/1.6.txt | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/docs/releases/1.6.txt b/docs/releases/1.6.txt index 7ca0062b0b..06d1a8d675 100644 --- a/docs/releases/1.6.txt +++ b/docs/releases/1.6.txt @@ -1116,8 +1116,10 @@ you should rename the method and conditionally add an alias with the old name:: 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) + get_queryset = (some_manager.get_queryset + if hasattr(some_manager, 'get_queryset') + else some_manager.get_query_set) + return get_queryset() # etc ``shortcut`` view and URLconf ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
