Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djangoldp
Manage
Activity
Members
Labels
Plan
Issues
99
Issue boards
Milestones
Wiki
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
djangoldp-packages
djangoldp
Commits
1da8518a
Commit
1da8518a
authored
4 years ago
by
Calum Mackervoy
Committed by
Benoit Alessandroni
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
bugfix: reinstating DjangoLDP custom viewset code
parent
5f7cd8b0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
djangoldp/views.py
+13
-1
13 additions, 1 deletion
djangoldp/views.py
with
13 additions
and
1 deletion
djangoldp/views.py
+
13
−
1
View file @
1da8518a
...
...
@@ -336,7 +336,19 @@ class LDPViewSetGenerator(ModelViewSet):
# append nested fields to the urls list
for
field
in
kwargs
.
get
(
'
nested_fields
'
)
or
cls
.
nested_fields
:
urls
.
append
(
re_path
(
'
^
'
+
detail_expr
+
field
+
'
/
'
,
cls
.
nested_urls
(
field
,
**
kwargs
)))
# the nested property may have a custom viewset defined
try
:
nested_model
=
kwargs
[
'
model
'
].
_meta
.
get_field
(
field
).
related_model
except
FieldDoesNotExist
:
nested_model
=
getattr
(
kwargs
[
'
model
'
],
field
).
field
.
model
if
hasattr
(
nested_model
,
'
get_view_set
'
):
kwargs
[
'
view_set
'
]
=
nested_model
.
get_view_set
()
urls_fct
=
kwargs
[
'
view_set
'
].
nested_urls
# our custom view_set may override nested_urls
else
:
urls_fct
=
cls
.
nested_urls
urls
.
append
(
re_path
(
'
^
'
+
detail_expr
+
field
+
'
/
'
,
urls_fct
(
field
,
**
kwargs
)))
return
include
(
urls
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment