Product list

35 views
Skip to first unread message

אברהם סרור

unread,
Aug 14, 2013, 12:00:50 PM8/14/13
to djang...@googlegroups.com
Hi,

My product model is named product, so I created a template named product_detail.html under templates/app folder
I also created product_list.html hoping it would also use it instead of the default, unfortunately it doesn't

How can I use my own template for product_list?
I thought I could create my templates and override every template in shop/templates, is that the wrong approach?

thanks
avraham

Caleb Njoroge

unread,
Aug 16, 2013, 8:42:58 PM8/16/13
to djang...@googlegroups.com
hello there,

   like any other class based django views, you can overide the django shop templates by passing the template name to the django shop view, in your urls, here is a quick example the way i do it

#  Product List
    url(r'^products_list/$',
        ShopListView.as_view(
            model=Product,
            template_name="product_list.html",
            context_object_name="product__list"
        ),
        name='products'
    ),

    # Order
    url(r'^orders/$',
        OrderListView.as_view(
            template_name="order_list.html",
            context_object_name="order_list"
        ),
        name='order_list'
    ), 


you can of course write you own list class based views 


cheers

Владислав Тарасенко

unread,
Aug 18, 2013, 6:51:09 AM8/18/13
to djang...@googlegroups.com
templates/shop/product_list.html - that template django-shop uses for products list.
Reply all
Reply to author
Forward
0 new messages