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
yusuf-musleh committed Oct 20, 2023
1 parent dd35747 commit 7126e46
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 @@ -120,11 +120,12 @@ def get_sub_tags_link(self, obj):
"""
if obj.children.count():
query_params = f"?parent_tag_id={obj.id}"
request = self.context.get("request")
url_namespace = request.resolver_match.namespace # get the namespace, usually "oel_tagging"
url = (
reverse("oel_tagging:taxonomy-tags", args=[str(obj.taxonomy_id)])
reverse(f"{url_namespace}:taxonomy-tags", args=[str(obj.taxonomy_id)])
+ query_params
)
request = self.context.get("request")
return request.build_absolute_uri(url)
return None

Expand Down

0 comments on commit 7126e46

Please sign in to comment.