1

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?

4

1 回答 1

2

这样做的方法是扩展您想要更改模板的视图,然后只需覆盖“template_name”变量。

例如:

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

class ProductCategoryView(OscarProductCategoryView):
    template_name = 'anotherdir/index.html'
于 2013-12-18T15:45:30.663 回答