M
M
Max2019-10-16 02:12:09
Django
Max, 2019-10-16 02:12:09

How to add dynamic content when rendering a page?

Good afternoon
There is django 2.2
There is a page template page.html
The task is to display dynamic content on the page from the TextField model.
template:

<div>
{{ content|safe }}
</div>

that is, we have a block, the data to which is transferred from the model
model.py
...
content = models.TextField()
...

In this text field in the model, we write data, such as
<p>Текст текст текст Текст текст текст  Текст текст текст {{ geo.adress }}  Текст текст текст Текст текст текст  Текст текст текст</p>

It is clear that this will not work. Such dynamic data is placed arbitrarily on pages, so it cannot be implemented through templates. Tell me how this is solved in django?
It will be great if you tell me from the office. docs, or sample code. I asked google but I couldn't find an answer, apparently I can't formulate the request correctly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-10-16
@Acaweb

How to remove shielding?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question