Skip to content

Commit

Permalink
fixing uri logic
Browse files Browse the repository at this point in the history
  • Loading branch information
snyaggarwal committed Dec 14, 2020
1 parent 52bab31 commit 8f9684b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,11 @@ def reverse_resource(resource, viewname, args=None, kwargs=None, **extra):
head = parent.get_latest_version()
else:
head = parent.head
kwargs.update({parent.get_url_kwarg(): parent.version})

if head:
kwargs.update({head.get_url_kwarg(): head.mnemonic})

kwargs.update({parent.get_url_kwarg(): parent.version})
parent_resource_url_kwarg = parent.get_resource_url_kwarg()
if parent_resource_url_kwarg not in kwargs:
kwargs.update({parent_resource_url_kwarg: parent.mnemonic})
Expand Down Expand Up @@ -112,10 +113,10 @@ def reverse_resource_version(resource, viewname, args=None, kwargs=None, **extra
head = resource.head

kwargs = kwargs or {}
kwargs.update({resource.get_url_kwarg(): resource.version})
if head:
kwargs.update({head.get_url_kwarg(): head.mnemonic})

kwargs.update({resource.get_url_kwarg(): resource.version})
resource_url_kwarg = resource.get_resource_url_kwarg()

if resource_url_kwarg not in kwargs:
Expand Down

0 comments on commit 8f9684b

Please sign in to comment.