From a42aa658270f07f99ccd2c4e6595e33728b64792 Mon Sep 17 00:00:00 2001 From: Matthijs Kooijman Date: Wed, 23 Jan 2008 20:54:38 +0100 Subject: [PATCH] * Make the character list a real character list again and move it /influences/character/. * Make a new index at /influences/ with a list of characters and influences. --- influences/views.py | 6 +++++ templates/influences/character_list.html | 1 - templates/influences/index.html | 28 ++++++++++++++++++++++++ urls.py | 3 ++- 4 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 templates/influences/index.html diff --git a/influences/views.py b/influences/views.py index 8471902..3b26dac 100644 --- a/influences/views.py +++ b/influences/views.py @@ -1,6 +1,7 @@ from django.shortcuts import render_to_response from django.shortcuts import get_object_or_404 from django.utils.translation import ugettext as _ +from django.contrib.auth.models import User from ee.influences.models import Character from ee.influences.models import Influence from ee.tools.forms import ContextModelForm @@ -45,3 +46,8 @@ def addCharacter(request): f = None return render_to_response('influences/add_character.html', {'message' : message, 'form' : f}) + +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}) diff --git a/templates/influences/character_list.html b/templates/influences/character_list.html index f6760cf..6673138 100644 --- a/templates/influences/character_list.html +++ b/templates/influences/character_list.html @@ -11,4 +11,3 @@ {% endif %}

{% trans "Add character" %}

-

{% trans "Submit influence" %}

diff --git a/templates/influences/index.html b/templates/influences/index.html new file mode 100644 index 0000000..e95fd02 --- /dev/null +++ b/templates/influences/index.html @@ -0,0 +1,28 @@ +{% load i18n %} +

{% trans "Your characters"%}

+{% if characters %} + +{% else %} +

{% trans "No characters. Add a character first, so you can submit your influences." %}

+{% endif %} + +

{% trans "Add character" %}

+ +

{% trans "Your influences" %}

+{% if influences %} + +{% else %} +

{% trans "No influences yet." %}

+{% endif %} + +

{% trans "Submit influence" %}

diff --git a/urls.py b/urls.py index 8890ef5..f3f7a1f 100644 --- a/urls.py +++ b/urls.py @@ -10,7 +10,8 @@ urlpatterns = patterns('', (r'^events/event/(?P\d+)/$', 'ee.events.views.event.detail'), (r'^events/event/(?P\d+)/regs$', 'ee.events.views.event.regs'), (r'^influences/add/(\d+)?/?$', 'ee.influences.views.add'), - (r'^influences/$', 'django.views.generic.list_detail.object_list', chars_dict), + (r'^influences/$', 'ee.influences.views.index'), + (r'^influences/character/$', 'django.views.generic.list_detail.object_list', chars_dict), (r'^influences/character/(?P\d+)/$', 'django.views.generic.list_detail.object_detail', chars_dict), (r'^influences/character/add/$', 'ee.influences.views.addCharacter'), (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'base/login.html'}), -- 2.30.2