[Answered ]-Django – using generic views

2👍

The decorator can be applied inside the urlpatterns like so:

urlpatterns = patterns('',
    url(r'^$', my_decorator(ListView.as_view(model= Product))),
)

Yes you have to manually write the template.
Also the name of the template is the_model_name_list.html by default but you can also define a custom template name like so:

urlpatterns = patterns('',
    url(r'^$', my_decorator(ListView.as_view(model= Product,
                                             template_name="custom_name.html"))),
)

Leave a comment