Skip to content

Commit

Permalink
Fix linked resources API
Browse files Browse the repository at this point in the history
  • Loading branch information
etj committed Jan 10, 2025
1 parent 29d5d1b commit 23610a9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions geonode/base/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1527,12 +1527,14 @@ def base_linked_resources_instances(instance, user, params={}):

def base_linked_resources_payload(instance, user, params={}):
lres = base_linked_resources_instances(instance, user, params)
ret = {
"linked_to": LinkedResourceSerializer(lres["linked_to"], embed=True, many=True).data,
"linked_by": LinkedResourceSerializer(
ret = {}
if "linked_to" in lres:
ret["linked_to"] = LinkedResourceSerializer(lres["linked_to"], embed=True, many=True).data
if "linked_by" in lres:
ret["linked_by"] = LinkedResourceSerializer(
instance=lres["linked_by"], serialize_source=True, embed=True, many=True
).data,
}
).data

if lres.get("WARNINGS", None):
ret["WARNINGS"] = lres["WARNINGS"]

Expand Down

0 comments on commit 23610a9

Please sign in to comment.