Branko Vukelic committed 1256598

Fixed #4: Use class name instead of verbose_name

Comments (0)

Files changed (2)

         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()
     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')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.