mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Handle case where ref_url is invalid (#6186)
This commit is contained in:
parent
a23235400d
commit
9f01962c4e
@ -539,8 +539,11 @@ def authorized_owners(group):
|
||||
@register.simple_tag()
|
||||
def object_link(url_name, pk, ref):
|
||||
"""Return highlighted link to object."""
|
||||
ref_url = reverse(url_name, kwargs={'pk': pk})
|
||||
return mark_safe(f'<b><a href="{ref_url}">{ref}</a></b>')
|
||||
try:
|
||||
ref_url = reverse(url_name, kwargs={'pk': pk})
|
||||
return mark_safe(f'<b><a href="{ref_url}">{ref}</a></b>')
|
||||
except NoReverseMatch:
|
||||
return None
|
||||
|
||||
|
||||
@register.simple_tag()
|
||||
|
Loading…
Reference in New Issue
Block a user