I defined my own youtube_embed_url Django filter in templatetags / custom_filters.py. It takes the URL of Youtube and returns a string, which is the code for the video. The code templatetags / custom_filters.py is shown below:
from django import template from django.conf import settings register = template.Library() import re @register.filter(name='youtube_embed_url')
Then I use this filter on the link_page.html page. Here is the relevant part of link_page.html:
<div> {{ link.url|youtube_embed_url }} </div>
However, when I look at the link page in a browser, I see the HTML code as a string:

Any idea how to get the result of the youtube_embed_url method to be interpreted as HTML code, not a string? Thanks in advance guys!
source share