From: Matthijs Kooijman
Date: Fri, 30 Jan 2009 19:39:55 +0000 (+0100)
Subject: Show the influence list sorted by character.
X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=6beee1d40828f4baae6e40f0617e60af5c7ac036;p=matthijs%2Fprojects%2Fxerxes.git
Show the influence list sorted by character.
(Note that I really mean sorted, not ordered). In addition, this also
shows, for each influence, if the character is only involved in it, or
if he/she initiated it.
---
diff --git a/influences/views.py b/influences/views.py
index e741605..ed23bb2 100644
--- a/influences/views.py
+++ b/influences/views.py
@@ -85,9 +85,9 @@ def character_detail(request, object_id):
@login_required
def influence_list(request):
- # Only show this player's influences
- os = Influence.objects.filter(initiator__player=request.user)
- return render_to_response('influences/influence_list.html', {'object_list' : os}, RequestContext(request))
+ # Only show the influences related to this player's characters
+ characters = request.user.character_set.all()
+ return render_to_response('influences/influence_list.html', {'characters' : characters}, RequestContext(request))
def influence_comment_preview(request, context_processors, extra_context, **kwargs):
# Use a custom template
diff --git a/templates/influences/index.html b/templates/influences/index.html
index 5f53b5e..a6a3998 100644
--- a/templates/influences/index.html
+++ b/templates/influences/index.html
@@ -40,9 +40,7 @@ single page, but I'll add that if that would help.
{% endwith %}
{% if characters %}
-{% with influences as object_list %}
{% include "influences/influence_list_block.html" %}
-{% endwith %}
{% endif %}
{% endblock %}
diff --git a/templates/influences/influence_list_block.html b/templates/influences/influence_list_block.html
index e59216f..4d74e40 100644
--- a/templates/influences/influence_list_block.html
+++ b/templates/influences/influence_list_block.html
@@ -1,14 +1,36 @@
{% load i18n %}
+{# Note that this template looks quite like character_detail_block, it is #}
+{# still different enough to not try and factor out the common parts #}
+{# currently... #}
+
{% trans "Your influences" %}
-{% if object_list %}
-
+{% if characters %}
+ {% for character in characters %}
+ {{ character.name }}
+ {% if character.initiated_influences.all or character.influences_involved_in.all %}
+ {% if character.initiated_influences.all %}
+ {% blocktrans with character.name as name %}Influences initiated by {{ name }}:{% endblocktrans %}
+
+ {% endif %}
+ {% if character.influences_involved_in.all %}
+ {% blocktrans with character.name as name %}Influences {{ name }} is involved in:{% endblocktrans %}
+
+ {% endif %}
+ {% else %}
+ {% trans "No influences yet." %}
+ {% endif %}
+ {% endfor %}
{% else %}
- {% trans "No influences yet." %}
+ {% trans "No characters. Add a character first, so you can submit your influences." %}
{% endif %}
{% trans "Submit influence" %}