Skip to content

Commit

Permalink
feat: support any URL namespace for tagging REST API
Browse files Browse the repository at this point in the history
  • Loading branch information
bradenmacdonald committed Oct 19, 2023
1 parent b578edf commit 2d5fb28
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions openedx_tagging/core/tagging/rest_api/v1/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,12 @@ def get_sub_tags_url(self, obj: TagData):
"""
if obj["child_count"] > 0 and "taxonomy_id" in self.context:
query_params = f"?parent_tag={obj['value']}"
request = self.context.get("request")
url_namespace = request.resolver_match.view_name.split(":")[0] # get the namespace, usually "oel_tagging"
url = (
reverse("oel_tagging:taxonomy-tags", args=[str(self.context["taxonomy_id"])])
reverse(f"{url_namespace}:taxonomy-tags", args=[str(self.context["taxonomy_id"])])
+ query_params
)
request = self.context.get("request")
return request.build_absolute_uri(url)
return None

Expand Down

0 comments on commit 2d5fb28

Please sign in to comment.