From: Matthijs Kooijman Date: Fri, 8 Feb 2008 20:02:26 +0000 (+0100) Subject: * Add login_required decorator to some views. X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=2984c52e602c1ced45bc4172182d826c64ef1240;p=matthijs%2Fprojects%2Fxerxes.git * Add login_required decorator to some views. --- diff --git a/influences/views.py b/influences/views.py index 1c0f648..6c48653 100644 --- a/influences/views.py +++ b/influences/views.py @@ -1,3 +1,4 @@ +from django.contrib.auth.decorators import login_required from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from django.template import RequestContext @@ -21,6 +22,7 @@ class CharacterForm(ContextModelForm): model = Character fields = ('name') +@login_required def add(request, character_id=None): initial = {} # Get the current user's characters @@ -41,6 +43,7 @@ def add(request, character_id=None): return render_to_response('influences/add.html', {'form' : f}, RequestContext(request)) +@login_required def addCharacter(request): f = CharacterForm(request=request) if (f.is_valid()): @@ -51,6 +54,7 @@ def addCharacter(request): return render_to_response('influences/add_character.html', {'form' : f}, RequestContext(request)) +@login_required def index(request): characters = request.user.character_set.all() influences = Influence.objects.filter(character__in=characters)