Skip to content

Commit

Permalink
feat(api): Add return URL to metadata if model has attribute get_url
Browse files Browse the repository at this point in the history
  • Loading branch information
jon-nfc committed Nov 15, 2024
1 parent e054ed6 commit 5145c2b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/api/react_ui_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,16 @@ def determine_metadata(self, request, view):

metadata["description"] = view.get_view_description()

if 'pk' in view.kwargs:

if view.kwargs['pk']:

qs = view.get_queryset()[0]

if hasattr(qs, 'get_url'):

metadata['return_url'] = qs.get_url( request )

metadata["renders"] = [
renderer.media_type for renderer in view.renderer_classes
]
Expand Down

0 comments on commit 5145c2b

Please sign in to comment.