L
L
leha782015-12-18 09:29:42
Django
leha78, 2015-12-18 09:29:42

Why should you use rendering?

I'm just diving into the world of django, and after reading the documentation, I have a lot of questions. One of them is about rendering.

>>> from django.template import Context, Template
>>> template = Template("My name is {{ my_name }}.")

>>> context = Context({"my_name": "Adrian"})
>>> template.render(context)
"My name is Adrian."

>>> context = Context({"my_name": "Dolores"})
>>> template.render(context)

in the Code, you can just send the variable to the template and substitute it there? What am I misunderstanding?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Kitaev, 2015-12-18
@leha78

Render does this to a greater extent.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question