Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
eafda855
Commit
eafda855
authored
May 24, 2011
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix up breadcrumbs to only breadcrumb for REST framework Views
parent
370274f5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
djangorestframework/tests/breadcrumbs.py
+5
-5
djangorestframework/utils/breadcrumbs.py
+4
-1
No files found.
djangorestframework/tests/breadcrumbs.py
View file @
eafda855
...
...
@@ -19,11 +19,11 @@ class NestedResourceInstance(View):
pass
urlpatterns
=
patterns
(
''
,
url
(
r'^$'
,
Root
),
url
(
r'^resource/$'
,
ResourceRoot
),
url
(
r'^resource/(?P<key>[0-9]+)$'
,
ResourceInstance
),
url
(
r'^resource/(?P<key>[0-9]+)/$'
,
NestedResourceRoot
),
url
(
r'^resource/(?P<key>[0-9]+)/(?P<other>[A-Za-z]+)$'
,
NestedResourceInstance
),
url
(
r'^$'
,
Root
.
as_view
()
),
url
(
r'^resource/$'
,
ResourceRoot
.
as_view
()
),
url
(
r'^resource/(?P<key>[0-9]+)$'
,
ResourceInstance
.
as_view
()
),
url
(
r'^resource/(?P<key>[0-9]+)/$'
,
NestedResourceRoot
.
as_view
()
),
url
(
r'^resource/(?P<key>[0-9]+)/(?P<other>[A-Za-z]+)$'
,
NestedResourceInstance
.
as_view
()
),
)
...
...
djangorestframework/utils/breadcrumbs.py
View file @
eafda855
...
...
@@ -4,6 +4,8 @@ from djangorestframework.utils.description import get_name
def
get_breadcrumbs
(
url
):
"""Given a url returns a list of breadcrumbs, which are each a tuple of (name, url)."""
from
djangorestframework.views
import
View
def
breadcrumbs_recursive
(
url
,
breadcrumbs_list
):
"""Add tuples of (name, url) to the breadcrumbs list, progressively chomping off parts of the url."""
...
...
@@ -12,7 +14,8 @@ def get_breadcrumbs(url):
except
:
pass
else
:
if
callable
(
view
):
# Check if this is a REST framework view, and if so add it to the breadcrumbs
if
isinstance
(
getattr
(
view
,
'cls_instance'
,
None
),
View
):
breadcrumbs_list
.
insert
(
0
,
(
get_name
(
view
),
url
))
if
url
==
''
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment