A
A
Anton2017-02-08 13:10:05
Django
Anton, 2017-02-08 13:10:05

How to make free space counter in base template?

Hello. I am making my own cloud, and I need to display the amount of free space the user has, the fact is that for each user I have my own folder on the disk. How can you pass the folder size to the base template without doing it in every view method?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Peter, 2017-02-08
Reytarovsky @Antonchik

For this, there are TEMPLATE CONTEXT PROCESSORS which are called for everything.

S
sim3x, 2017-02-08
@sim3x

In order not to

doing this in every view method
use CBV or a separate function with a common context in case of functional
views

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question