Traian
Traian

Reputation: 3003

Django-Oscar override templatetags

I tried to override category_tags by creating a local version of catalogue application with a local templatetags folder which has a category_tags.py file (also init.py). It seems the default category_tags file is used. If I change the name of my local tag file and of course I load the new name of the tag in the template it works but I would like to override or extend the default category_tags not to create another one.

Any ideas?

thanks!

Upvotes: 5

Views: 1782

Answers (2)

Nostalg.io
Nostalg.io

Reputation: 3752

I got it working by putting the templates in my project_folder > templates > oscar_app_name > template_name.html

So to override the "checkout" app and template, my structure looks like this:

/project
--/apps
----/checkout
------[change checkout models]
----__init__.py
----app.py

--/project
----/templates
------/checkout
--------payment_details.html

----__init__.py
----settings.py
----urls.py

--manage.py

And then you have to edit settings.py Installed Apps

INSTALLED_APPS = [
    'django.contrib.admin',
    ...
    'compressor',
    'paypal',
] + get_core_apps(['apps.checkout'])

Upvotes: 1

Maik Hoepfel
Maik Hoepfel

Reputation: 1797

I would assume that template tags get loaded in the order specified in INSTALLED_APPS. Does the app containing your category_tags.py come before (or instead of, e.g. when using Oscar's get_core_apps override to extend an Oscar core app) oscar.core.apps.catalogue?

PS. I'm an Oscar author and have to admit we don't check StackOverflow very often. The mailing list is your best bet at the moment.

Upvotes: 0

Related Questions