问题
I'm calling this template tag from a different app within the same project. However I'd like to make changes on it to make it work better on the app I'm working on.
I simply created a templatetags directory inside my app and copied the template tag file inside then went about my changes. So it kinda looks like this:
theotherapp/templatetags/sometags.py
myapp/templatetags/sometags.py
What I noticed is that the other app's template tag is still the one being used. But when I change the filename of the template tag in my app ...
myapp/templatetags/sometags.py -> myapp/templatetags/sometags_myapp.py
and then rename the template tags loaded to the new one in my script, it works as intended. But I don't want to do it that way.
My question is:
How do I let Django know to use the template tag script local to my app given that it has the same filename with another app's template tag?
But I'd still like to retain that Django still looks into the other app's template tags as the other apps in the projects are depending on it.
I'm using Django 1.3 by the way.
来源:https://stackoverflow.com/questions/16050990/how-to-load-app-specific-template-tag-in-django