Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """
- How to get the csrf_protect around a generic view. Which you need if you are working with comments.
- """
- from django.conf.urls.defaults import *
- from django.views.decorators.csrf import csrf_protect
- from django.views.generic.list_detail import object_detail
- from myapp.blog.models import Cartwheel
- info_dict = {
- 'queryset':Cartwheel.objects.all(),
- }
- urlpatterns = patterns('',
- url(
- regex = '^(?P<slug>[\w-]+)/$',
- view = csrf_protect(object_detail),
- name = 'cartwheel_detail',
- kwargs=dict(
- info_dict,
- template_name='cartwheel/cartwheel_detail.html',
- )
- ),
- )
Add Comment
Please, Sign In to add comment