Skip to content

Commit

Permalink
Return custom settings with app API requests
Browse files Browse the repository at this point in the history
  • Loading branch information
swainn committed Jan 5, 2024
1 parent b818328 commit 8ec874f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tethys_portal/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@ def get_app(request, app):
except TethysApp.DoesNotExist:
return JsonResponse({"error": f'Could not find app "{app}".'})

custom_settings = {}
if request.user.is_authenticated:
custom_settings = {
s.name: {
"type": s.type,
"value": s.get_value(),
}
for s in app.custom_settings
}

metadata = {
"title": app.name,
"description": app.description,
Expand All @@ -55,5 +65,6 @@ def get_app(request, app):
"exitUrl": reverse("app_library"),
"rootUrl": reverse(app.index_url),
"settingsUrl": f'{reverse("admin:index")}tethys_apps/tethysapp/{ app.id }/change/',
"customSettings": custom_settings,
}
return JsonResponse(metadata)

0 comments on commit 8ec874f

Please sign in to comment.