mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-18 04:20:53 +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)
|
return template.render(context)
|
||||||
elif isinstance(value, str):
|
elif isinstance(value, str):
|
||||||
if (
|
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)
|
re.search(r'\s', value)
|
||||||
):
|
):
|
||||||
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))
|
return mark_safe('<a href="{value}">{value}</a>'.format(value=escape(value)))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user