* Make a new index at /influences/ with a list of characters and influences.
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
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})
{% endif %}
<p><a href="character/add">{% trans "Add character" %}</a></p>
-<p><a href="add">{% trans "Submit influence" %}</a></p>
--- /dev/null
+{% load i18n %}
+<h2>{% trans "Your characters"%}</h2>
+{% if characters %}
+ <ul>
+ {% for character in characters %}
+ <li><a href="character/{{ character.id }}/">{{ character.name }}</a></li>
+ {% endfor %}
+ </ul>
+{% else %}
+ <p>{% trans "No characters. Add a character first, so you can submit your influences." %}</p>
+{% endif %}
+
+<p><a href="character/add">{% trans "Add character" %}</a></p>
+
+<h2>{% trans "Your influences" %}</h2>
+{% if influences %}
+ <ul>
+ {% for influence in influences %}
+ <!--<li><a href="character/{{ character.id }}/">{{
+ character.name }}</a></li>-->
+ <li>{{ influence.character }} -- {{ influence.contact }} -- {{ influence.description }}</li>
+ {% endfor %}
+ </ul>
+{% else %}
+ <p>{% trans "No influences yet." %}</p>
+{% endif %}
+
+<p><a href="add">{% trans "Submit influence" %}</a></p>
(r'^events/event/(?P<event_id>\d+)/$', 'ee.events.views.event.detail'),
(r'^events/event/(?P<event_id>\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<object_id>\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'}),