diff options
| author | Tom Christie | 2014-08-29 10:03:07 +0100 |
|---|---|---|
| committer | Tom Christie | 2014-08-29 10:03:07 +0100 |
| commit | 8f4ae06b3b3b9572d72529ffad1842f63ca67d91 (patch) | |
| tree | 2fc2c0ce267ae04e69213a810286c8b47b02826f /rest_framework/routers.py | |
| parent | bb1604674f05c0fa5c62e7bb3e7b9d12fd9bf648 (diff) | |
| parent | 8b2052172cf7138203e683731c30bd279c6e722a (diff) | |
| download | django-rest-framework-8f4ae06b3b3b9572d72529ffad1842f63ca67d91.tar.bz2 | |
Merge pull request #1784 from tomchristie/remove-model-attribute
Deprecate `.model` attribute on views
Diffstat (limited to 'rest_framework/routers.py')
| -rw-r--r-- | rest_framework/routers.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/rest_framework/routers.py b/rest_framework/routers.py index 406ebcf7..ae56673d 100644 --- a/rest_framework/routers.py +++ b/rest_framework/routers.py @@ -128,6 +128,9 @@ class SimpleRouter(BaseRouter): If `base_name` is not specified, attempt to automatically determine it from the viewset. """ + # Note that `.model` attribute on views is deprecated, although we + # enforce the deprecation on the view `get_serializer_class()` and + # `get_queryset()` methods, rather than here. model_cls = getattr(viewset, 'model', None) queryset = getattr(viewset, 'queryset', None) if model_cls is None and queryset is not None: @@ -135,7 +138,7 @@ class SimpleRouter(BaseRouter): assert model_cls, '`base_name` argument not specified, and could ' \ 'not automatically determine the name from the viewset, as ' \ - 'it does not have a `.model` or `.queryset` attribute.' + 'it does not have a `.queryset` attribute.' return model_cls._meta.object_name.lower() |
