aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/utils/breadcrumbs.py
diff options
context:
space:
mode:
authorTom Christie2013-08-29 20:51:51 +0100
committerTom Christie2013-08-29 20:51:51 +0100
commit02b6836ee88498861521dfff743467b0456ad109 (patch)
tree08ccb354d61292aaf15bd60c5e54adf5528e5880 /rest_framework/utils/breadcrumbs.py
parent556b4bbba9a735cd372d5b12e9fdccd256643cb2 (diff)
downloaddjango-rest-framework-02b6836ee88498861521dfff743467b0456ad109.tar.bz2
Fix breadcrumb view names
Diffstat (limited to 'rest_framework/utils/breadcrumbs.py')
-rw-r--r--rest_framework/utils/breadcrumbs.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/rest_framework/utils/breadcrumbs.py b/rest_framework/utils/breadcrumbs.py
index 0384faba..e6690d17 100644
--- a/rest_framework/utils/breadcrumbs.py
+++ b/rest_framework/utils/breadcrumbs.py
@@ -8,8 +8,11 @@ def get_breadcrumbs(url):
tuple of (name, url).
"""
+ from rest_framework.settings import api_settings
from rest_framework.views import APIView
+ view_name_func = api_settings.VIEW_NAME_FUNCTION
+
def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen):
"""
Add tuples of (name, url) to the breadcrumbs list,
@@ -28,8 +31,8 @@ def get_breadcrumbs(url):
# Don't list the same view twice in a row.
# Probably an optional trailing slash.
if not seen or seen[-1] != view:
- instance = view.cls()
- name = instance.get_view_name()
+ suffix = getattr(view, 'suffix', None)
+ name = view_name_func(cls, suffix)
breadcrumbs_list.insert(0, (name, prefix + url))
seen.append(view)