The documentation says that the tags should be stored in the templatetags folder of applications, but there are tags that need to be used throughout the project. It is clear that it is possible to dig everything out according to applications, but it is not beautiful :( Is there a correct solution to this problem?
2 answers
We use the utilites
application for this purpose, you can call it something else. And there already create tags, methods and classes that are necessary for other applications to work.
Copy-paste of course nothing. Just in the places you need to import the necessary modules.
In the templates, respectively, load
.
- 2Or even
common
, once common. Quite a solution - neoascetic - 2Yes, it is possible and
common
. Just a good idea to be sure that it does not overlap with any built-incommon
module;). - ChehoV
|
Why copy-paste? Suppose there is an application app1
in the projectus
project in which the tag / function / class / avatar_src
class is avatar_src
which is used in other applications. What prevents to do
from projectus.app1.tags import avatar_src
in places where it is needed?
|