How do I override a template-tag for the "pinax" application in Django?

24 Views Asked by At

Unfortunately for me, the "pinax" application for Django does not seem to have stayed up with the times – in one specific way: the shorttimesince template-tag still refers to the tzinfo object which has been deprecated.

The message is this:

 django.template.library.InvalidTemplateLibrary: Invalid template library specified. ImportError raised when trying to load 'pinax.templatetags.templatetags.shorttimesince_tag': No module named 'django.utils.tzinfo'

In my project, I have a overrides/pinax/templatetags directory which contains both __init__.py and shorttimesince_tag.py which contains the updated code. But it does not seem to be referenced. (And I think that, after studying this problem, I see why not.)

I need to be able to override a templatetag that is defined in a third-party application. Does Django actually know where a templatetag is defined? Please guide me to a swift and appropriate solution.

Pardon me, community ... I am very befuddled by all of this, and writing this while "still befuddled."

1

There are 1 best solutions below

0
Mike Robinson On

Sorry to have left this question sitting around unanswered for so long ... here is what I finally (and, successfully) decided to do.

I realized that the "pinax" library application appears to no longer be maintained, even though there is really (so far ...) only this one slight problem with it. So, I moved the package into my own project and removed it from the library (and from requirements.txt ...). After first branching and git-committing the change which moved it, I then made the very-trivial change to fix the problem with shorttimesince_tag.py and committed that, then merged my branch into the mainline. From now on, "pinax" has officially become "part of my project."

"It's really too bad" when really-great packages like "pinax" come to be abandoned, but every now and again it happens, I suppose . . . we are all volunteers.