Created
April 30, 2010 15:42
-
-
Save pydanny/385372 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| 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', | |
| ) | |
| ), | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment