mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-04-25 11:33:43 +03:00
Pass initkwargs stored on view to instance
This commit is contained in:
parent
5e6b233977
commit
f1ca71ce21
|
@ -24,11 +24,12 @@ def get_breadcrumbs(url, request=None):
|
||||||
# Check if this is a REST framework view,
|
# Check if this is a REST framework view,
|
||||||
# and if so add it to the breadcrumbs
|
# and if so add it to the breadcrumbs
|
||||||
cls = getattr(view, 'cls', None)
|
cls = getattr(view, 'cls', None)
|
||||||
|
initkwargs = getattr(view, 'initkwargs', {})
|
||||||
if cls is not None and issubclass(cls, APIView):
|
if cls is not None and issubclass(cls, APIView):
|
||||||
# Don't list the same view twice in a row.
|
# Don't list the same view twice in a row.
|
||||||
# Probably an optional trailing slash.
|
# Probably an optional trailing slash.
|
||||||
if not seen or seen[-1] != view:
|
if not seen or seen[-1] != view:
|
||||||
c = cls()
|
c = cls(**initkwargs)
|
||||||
c.suffix = getattr(view, 'suffix', None)
|
c.suffix = getattr(view, 'suffix', None)
|
||||||
name = c.get_view_name()
|
name = c.get_view_name()
|
||||||
insert_url = preserve_builtin_query_params(prefix + url, request)
|
insert_url = preserve_builtin_query_params(prefix + url, request)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user