Commits

Branko Vukelic committed 1256598

Fixed #4: Use class name instead of verbose_name

  • Participants
  • Parent commits 18b4af7

Comments (0)

Files changed (2)

File related/views.py

         return self.related_404_redirect_url
 
     def get_related_404_message(self):
-        return self.related_404_message % self.related_model._meta.verbose_name
+        return self.related_404_message % self.get_related_field()
 
     def related_not_found(self):
         messages.error(self.request, self.get_related_404_message())
         return  HttpResponseRedirect(self.get_related_404_url())
 
     def get_related_field(self):
-        return self.related_field or self.related_model._meta.verbose_name
+        return self.related_field or self.related_model.__name__.lower()
 
     def get_object_kwargs(self):
         object_kwargs = dict()

File tests/tests.py

 
     def test_get_related_field(self):
         self.view.related_model = Mock()
-        self.view.related_model._meta = Mock()
-        self.view.related_model._meta.verbose_name = 'foo'
+        self.view.related_model.__name__ = 'Foo'
 
         rf = self.view.get_related_field()
         self.assertEqual(rf, 'foo')