From: Matthijs Kooijman Date: Sun, 10 Feb 2008 14:19:10 +0000 (+0100) Subject: * Use a relationship spanning lookup to get the list of a player's influences, inste... X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=d7ec83278b295b76ba2694e01b99b2c79e846611;p=matthijs%2Fprojects%2Fxerxes.git * Use a relationship spanning lookup to get the list of a player's influences, instead of using two lookups. --- diff --git a/influences/views.py b/influences/views.py index 1ff4dcb..cd8d4a9 100644 --- a/influences/views.py +++ b/influences/views.py @@ -62,8 +62,9 @@ def addCharacter(request): @login_required def index(request): + # Only show this player's characters and influences characters = request.user.character_set.all() - influences = Influence.objects.filter(character__in=characters) + influences = Influence.objects.filter(character__player=request.user) return render_to_response('influences/index.html', {'characters' : characters, 'influences' : influences}, RequestContext(request)) @login_required