Commits

Matthew Schinckel committed aad4539

Don't create an 'href' attribute on model class if there is already one there..
Fix deprecation warning.

  • Participants
  • Parent commits 9ba3d5b

Comments (0)

Files changed (2)

rest_api/options.py

         self.fields = self.fields or [field.name for field in self.opts.fields if field.name not in self.exclude]
         if api_site.index_provides_data:
             self.index_fields = self.fields
-        model.href = property(lambda x: reverse('api:%s_%s_object' % (model._meta.app_label, model._meta.module_name), args=(x.pk,)))
+        if not hasattr(model, 'href'):
+            model.href = property(lambda x: reverse('api:%s_%s_object' % (model._meta.app_label, model._meta.module_name), args=(x.pk,)))
         self.root_path = self.root_path or snake_case(model.__name__)
         super(ModelApi, self).__init__()
         

tests/test_rest_api/settings.py

 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
     'django.template.loaders.filesystem.load_template_source',
-    'django.template.loaders.app_directories.load_template_source',
+    'django.template.loaders.app_directories.Loader',
     'django.template.loaders.eggs.load_template_source',
 )