I want to disable the Browsable API display URL from becoming a hyperlink automatically.

44 views
Skip to first unread message

高原健

unread,
Jul 7, 2019, 9:10:08 PM7/7/19
to Django REST framework

Hello.


It's convenient to be able to run REST from a browsable API using django-rest-framework.
If JSON contains a URL, it will automatically become a hyperlink.

I handle dangerous domains, so I do not want them to be easily hyperlinked.

Please let me know if there is a way to disable the ability to make URLs automatically hyperlinks.


Thank you.

ここにコードを入力...

salimon jamiu olashile

unread,
Jul 8, 2019, 2:37:28 AM7/8/19
to django-res...@googlegroups.com
Hello,

I’ve some questions.

Do you want to remove the url & use something else like the pk to represent relationships?

Or

Do you just want to disable the urls?

Regards.

Ken TKHR

unread,
Jul 8, 2019, 3:48:27 AM7/8/19
to Django REST framework
Hello.

> Do you want to remove the url & use something else like the pk to represent relationships?
No, I want my REST URLs to be hyperlinks.

> Do you just want to disable the urls?
That's it. I have stored dangerous URLs in my database. Therefore, I want to use the Browsable API safely.

Thanks.


2019年7月8日月曜日 15時37分28秒 UTC+9 salimon jamiu olashile:

Tim Watts

unread,
Jul 8, 2019, 4:16:26 AM7/8/19
to django-rest-framework
I think you will have to override the "rest_bramework/base.html" in your project and remove the "urlize_quoted_links" filter.

Alternatively maybe the AdminRenderer will work for you: https://www.django-rest-framework.org/api-guide/renderers/#adminrenderer

Tim

--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-rest-framework/79a8a073-1106-4512-bf0f-3299286fab49%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

salimon jamiu olashile

unread,
Jul 8, 2019, 8:15:03 AM7/8/19
to django-res...@googlegroups.com
Hello, 

From what I understand, you want to use a relative url instead of an absolute url.

Check out this link:

Ken TKHR

unread,
Jul 11, 2019, 8:38:54 PM7/11/19
to Django REST framework
Hi Tim.
 
Thank you for your reply.
I will try the method taught.

After trying, I might ask a question again.

Thank you.
Reply all
Reply to author
Forward
0 new messages