m03geek
m03geek

Reputation: 2538

Django oscar custom template file structure

I'm trying to write my custom template for django oscar. I have completly different template structure from original oscar's template. But for now it uses many default oscar views.

The problem is that template path is hardcoded in oscar's default view. I.e.

template_name = 'catalogue/browse.html'

And I need something like:

template_name = 'anotherdir/index.html'

What is the best/easiest way to override this template paths and leave default oscar views logic?

Upvotes: 1

Views: 1563

Answers (1)

Alex Crawley
Alex Crawley

Reputation: 166

The way to do this is to extend the views for which you want to change the templates, then just override the "template_name" variable.

eg:

from oscar.apps.catalogue.views import ProductCategoryView as OscarProductCategoryView

class ProductCategoryView(OscarProductCategoryView):
    template_name = 'anotherdir/index.html'

Upvotes: 3

Related Questions