mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 19:14:01 +03:00
Made relative URLs clickable as well. (#8464)
This commit is contained in:
parent
5185cc9348
commit
82475c232b
|
@ -218,7 +218,7 @@ def format_value(value):
|
|||
return template.render(context)
|
||||
elif isinstance(value, str):
|
||||
if (
|
||||
(value.startswith('http:') or value.startswith('https:')) and not
|
||||
(value.startswith('http:') or value.startswith('https:') or value.startswith('/')) and not
|
||||
re.search(r'\s', value)
|
||||
):
|
||||
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user