S
S
Stanislav Shabalin2021-01-13 12:38:19
Django
Stanislav Shabalin, 2021-01-13 12:38:19

Exception from single block page caching in Django?

Tell me, pliz, what is the right thing to do in a situation where you need to block part of the page code for caching?
The problem now is that I cache the entire page through the decorator, where I call the rating form, and after reloading the page, the set rating is not displayed, as if it had not been set.

There is a feeling that the browser can cache more, but here, through the meta in the head block of the html template, you can disable caching again for the entire page.

I will be grateful for any solutions in this area.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-01-13
@Starck43

If caching is done by a decorator, then it does not know anything about any pages and their parts, for it the cached data is just a string returned by the function. For partial caching, use the cache tag .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question