Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is difference between {{}} and {% %} in django templates

I am very new to django and working on it.. I visited a html file and dont know the difference between {{}} and {% %} in html files used as here

{% load static %}

Thanks a lot

like image 876
HERAwais Avatar asked Jan 01 '18 13:01

HERAwais


3 Answers

You can use

  • {% %} For sentences such as if and for or to call tags such as load, static, etc.

  • {{ }} To render variables in the template.

Read More about it at Django Docs

like image 85
Usman Maqbool Avatar answered Oct 25 '22 23:10

Usman Maqbool


{% %} is for displaying code and {{}} is for displaying variables

like image 27
Ken Avatar answered Oct 26 '22 00:10

Ken


There are three things in the template in Django First is template variable and the second thing is template tag and third and last is template filter so we write a template variable is {{}} and write a template tag is {% %} third and last is template filter {{variable |filter:arg}}

like image 32
Aditya Gupta Avatar answered Oct 26 '22 01:10

Aditya Gupta