override custom template tags

333 views
Skip to first unread message

wielliam tell

unread,
Aug 27, 2014, 4:43:31 PM8/27/14
to django...@googlegroups.com
How can I override the custom template tags? I have placed a templatetags directory on the same level where my template directory is but it doesn't seem be getting picked up.

I placed __init__.py inside the directory and then tried to override basket_tags.py

from oscar.templatetags import basket_tags

David Winterbottom

unread,
Aug 28, 2014, 5:20:50 AM8/28/14
to django-oscar
On 27 August 2014 21:43, wielliam tell <wiel...@gmail.com> wrote:
How can I override the custom template tags? I have placed a templatetags directory on the same level where my template directory is but it doesn't seem be getting picked up.

​Sounds like your templatetags are in the wrong place. They need to be inside an app folder:

Even with that, I'm not quite sure how Django resolves templatetag lookups. It probably loops over INSTALLED_APPS looking for a match, so you may need to place your app (which has your templatetags) ​before 'oscar' in INSTALLED_APPS. 

Another option is to override the templates that use the tag you want to customise, and point them to your new template tag (which can have a different name). However, if the tag you want to customise appears in lots of places, this would be a pain.

 

I placed __init__.py inside the directory and then tried to override basket_tags.py

from oscar.templatetags import basket_tags

--
https://github.com/tangentlabs/django-oscar
http://django-oscar.readthedocs.org/en/latest/
https://twitter.com/django_oscar
---
You received this message because you are subscribed to the Google Groups "django-oscar" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-oscar...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-oscar.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-oscar/fabf0ba8-4b0f-4d93-abc5-60719c3c8c61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Winterbottom
Technical Director

Tangent Snowball
84-86 Great Portland Street
London W1W 7NR
England, UK

Reply all
Reply to author
Forward
0 new messages