diff options
| author | Markus Kaiserswerth | 2013-09-23 17:48:25 +0200 | 
|---|---|---|
| committer | Markus Kaiserswerth | 2013-09-23 17:48:25 +0200 | 
| commit | abbe9213f98b5e1d3b53db2c1711d9221c5b257f (patch) | |
| tree | f4cc92b7af363d7f1057d00af6ba2b84a220d766 /rest_framework/compat.py | |
| parent | 0e58d4c74fb10b0fba90ae74bf3de5bca98cf608 (diff) | |
| download | django-rest-framework-abbe9213f98b5e1d3b53db2c1711d9221c5b257f.tar.bz2 | |
Address pending deprecation of Model._meta.module_name in Django 1.6
Diffstat (limited to 'rest_framework/compat.py')
| -rw-r--r-- | rest_framework/compat.py | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/rest_framework/compat.py b/rest_framework/compat.py index b9d1dae6..581e29fc 100644 --- a/rest_framework/compat.py +++ b/rest_framework/compat.py @@ -80,6 +80,14 @@ except ImportError:          Image = None +def get_model_name(model_cls): +    try: +        return model_cls._meta.model_name +    except AttributeError: +        # < 1.6 used module_name instead of model_name +        return model_cls._meta.module_name + +  def get_concrete_model(model_cls):      try:          return model_cls._meta.concrete_model | 
