The default get_view_name method should attempt to get the view's name from the view's instance.

This commit is contained in:
Omer Katz 2013-10-08 17:42:42 +02:00
parent 761e66ffdd
commit d34978de9e

View File

@ -22,6 +22,10 @@ def get_view_name(view_cls, suffix=None):
This function is the default for the `VIEW_NAME_FUNCTION` setting. This function is the default for the `VIEW_NAME_FUNCTION` setting.
""" """
try:
view = view_cls()
name = view.get_view_name()
else:
name = view_cls.__name__ name = view_cls.__name__
name = formatting.remove_trailing_string(name, 'View') name = formatting.remove_trailing_string(name, 'View')
name = formatting.remove_trailing_string(name, 'ViewSet') name = formatting.remove_trailing_string(name, 'ViewSet')