So I was following the Django tutorial and came across this:
{{ question }}
I am very confused as to what that inner set of curly braces are for. I assumed the outer set was meant to differentiate python from the html django says to put.
Could someone please explain to me what the inner set of curly braces are for?
JSON syntax is basically considered as a subset of JavaScript syntax; it includes the following − Data is represented in name/value pairs. Curly braces hold objects and each name is followed by ':'(colon), the name/value pairs are separated by , (comma). Square brackets hold arrays and values are separated by ,(comma).
The double curly brackets are not HTML but scripting code. The term inside, interest, is a placeholder, sort of like the name and address in a form letter. The string {{interest}} will be replaced when the HTML template is converted into straight HTML that is sent over the network to the user.
It says that double curly braces {{ variable }} are used to evaluate expressions. Whilst distinguishing a single curly braces (after a colon), that is used to declare a dictionary.
Interpolation in Angular In simple terms, when you send data from an Angular component to the template using the mustache syntax or what you would call double curly brackets (these: “{{ … }}”) it is called interpolation. You can use it with variables, objects and even functions.
The curly braces are part of Django Template Language
The part encapsulated between double curly braces {{
}}
is nothing but a variable.
That's how DTL, Jinja2 and other template languages work. They have their own set of rules which translates the template in to python and later to HTML code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With