* Add wrappers around the generic views, so we can add the @login_required decorator.
authorMatthijs Kooijman <matthijs@stdio.flexvps.nl>
Fri, 8 Feb 2008 21:44:50 +0000 (22:44 +0100)
committerMatthijs Kooijman <matthijs@stdio.flexvps.nl>
Fri, 8 Feb 2008 21:44:50 +0000 (22:44 +0100)
influences/views.py
urls.py

index 6c4865340264b5654a64a09d43d537160d7516ba..341c9a3dc696161cf36bffee8a640a5946dcece6 100644 (file)
@@ -6,6 +6,7 @@ from django.utils.translation import ugettext as _
 from django.contrib.auth.models import User
 from django.core.urlresolvers import reverse
 from django.http import HttpResponseRedirect
+from django.views.generic.list_detail import object_detail, object_list
 from ee.influences.models import Character
 from ee.influences.models import Influence
 from ee.tools.forms import ContextModelForm
@@ -59,3 +60,15 @@ def index(request):
     characters = request.user.character_set.all()
     influences = Influence.objects.filter(character__in=characters)
     return render_to_response('influences/index.html', {'characters' : characters, 'influences' : influences}, RequestContext(request))
+
+@login_required
+def character_list(*args, **kwargs):
+    return object_list(*args, **kwargs)
+
+@login_required
+def character_detail(*args, **kwargs):
+    return object_detail(*args, **kwargs)
+
+@login_required
+def influence_detail(*args, **kwargs):
+    return object_detail(*args, **kwargs)
diff --git a/urls.py b/urls.py
index 086f58a54c060a27d8ad9e55f0ecdb9bc5e0dc46..652b7a94da9952462586ef2fca1d5d8cfed21348 100644 (file)
--- a/urls.py
+++ b/urls.py
@@ -21,10 +21,10 @@ urlpatterns = patterns('',
     url(r'^influences/$', 'ee.influences.views.index', name='influences_index'),
     url(r'^influences/influence/add/(\d+)/$', 'ee.influences.views.add', name='influences_add_influence_for_character'),
     url(r'^influences/influence/add/$', 'ee.influences.views.add', name='influences_add_influence'),
-    url(r'^influences/influence/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', influences_dict, name='influences_influence_detail'),
+    url(r'^influences/influence/(?P<object_id>\d+)/$', 'ee.influences.views.influence_detail', influences_dict, name='influences_influence_detail'),
     
-    url(r'^influences/character/$', 'django.views.generic.list_detail.object_list', chars_dict, name='influences_character_list'),
-    url(r'^influences/character/(?P<object_id>\d+)/$', 'django.views.generic.list_detail.object_detail', chars_dict, name='influences_character_detail'),
+    url(r'^influences/character/$', 'ee.influences.views.character_list', chars_dict, name='influences_character_list'),
+    url(r'^influences/character/(?P<object_id>\d+)/$', 'ee.influences.views.character_detail', chars_dict, name='influences_character_detail'),
     url(r'^influences/character/add/$', 'ee.influences.views.addCharacter', name='influences_add_character'),
 
     url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'base/login.html'}, name='login'),