This commit is contained in:
Ollie Walsh 2015-08-14 12:20:25 +01:00
parent 3d0292e1cd
commit 332c30afb9
2 changed files with 2 additions and 4 deletions

View File

@ -9,11 +9,8 @@ def get_breadcrumbs(url, request=None):
tuple of (name, url). tuple of (name, url).
""" """
from rest_framework.reverse import preserve_builtin_query_params from rest_framework.reverse import preserve_builtin_query_params
from rest_framework.settings import api_settings
from rest_framework.views import APIView from rest_framework.views import APIView
view_name_func = api_settings.VIEW_NAME_FUNCTION
def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen): def breadcrumbs_recursive(url, breadcrumbs_list, prefix, seen):
""" """
Add tuples of (name, url) to the breadcrumbs list, Add tuples of (name, url) to the breadcrumbs list,

View File

@ -31,6 +31,7 @@ class NestedResourceRoot(APIView):
class NestedResourceInstance(APIView): class NestedResourceInstance(APIView):
pass pass
class CustomNameResourceInstance(APIView): class CustomNameResourceInstance(APIView):
def get_view_name(self): def get_view_name(self):
return "Foo" return "Foo"
@ -89,7 +90,7 @@ class BreadcrumbTests(TestCase):
('Resource Root', '/resource/'), ('Resource Root', '/resource/'),
('Foo', '/resource/customname') ('Foo', '/resource/customname')
] ]
) )
def test_nested_resource_breadcrumbs(self): def test_nested_resource_breadcrumbs(self):
url = '/resource/123/' url = '/resource/123/'