How to insert data inside the html tag by fetching from django database?

is it possible in django to fetch data from database and insert it inside the html tag. I've created a below model and I want to put its data into respective html tags.

 class Metadata(models.Model):
    meta_name = models.CharField()
    meta_desc = models.TextField()
    meta_key = models.TextField()

def func(request):
    desc = Metadata.objects.get(meta_desc="some text")
    desc_k = Metadata.objects.get(meta_key="some text")
    return render(request, "results.html", {'desc':desc,'desc_k':desc_k})

I want to fetch this meta_desc and meta_key data and insert it into below HTML tags respective to its matching meta_name. I tried above function but its not working, I guess either its not possible to do that or i'm doing it wrong.


 <meta name="description" content=" {{ desc.meta_desc }}">
 <meta name="keywords" content="{{ desc_k.meta_key }}">

Please suggest me if there is any other way to do this? Thanks

Back to Top