Séparation de la liste des jeux avec les jeux en cours + Timelines

master
Olivier DOSSMANN 2018-02-19 22:21:06 +01:00
parent a5bcbf0c7e
commit c9e9ec46fa
5 changed files with 87 additions and 72 deletions

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-02-04 20:18+0000\n"
"PO-Revision-Date: 2018-02-04 19:02+0100\n"
"POT-Creation-Date: 2018-02-19 21:17+0000\n"
"PO-Revision-Date: 2018-02-19 22:18+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -53,75 +53,75 @@ msgstr "Information"
msgid "Progress"
msgstr "Progression"
#: figurines/models.py:15 figurines/models.py:29
#: figurines/models.py:17 figurines/models.py:32
msgid "set"
msgstr "collection"
#: figurines/models.py:16
#: figurines/models.py:18
msgid "sets"
msgstr "collections"
#: figurines/models.py:19
#: figurines/models.py:22
msgid "Usual name of figurines set."
msgstr "Nom habituel de la collection de figurines."
#: figurines/models.py:44
#: figurines/models.py:47
msgid "Character"
msgstr "Personnage"
#: figurines/models.py:45
#: figurines/models.py:48
msgid "Vehicle"
msgstr "Véhicule"
#: figurines/models.py:46
#: figurines/models.py:49
msgid "Level pack"
msgstr "Niveau supplémentaire"
#: figurines/models.py:47
#: figurines/models.py:50
msgid "Gadget"
msgstr "Gadget"
#: figurines/models.py:48
#: figurines/models.py:51
msgid "Battle pack"
msgstr "Arène supplémentaire"
#: figurines/models.py:49
#: figurines/models.py:52
msgid "Expansion pack"
msgstr "Extension"
#: figurines/models.py:50
#: figurines/models.py:53
msgid "Trophy"
msgstr "Trophé"
#: figurines/models.py:51
#: figurines/models.py:54
msgid "Trap"
msgstr "Piège"
#: figurines/models.py:57
#: figurines/models.py:59
msgid "kind"
msgstr "sorte"
#: figurines/models.py:61 games/models.py:67
#: figurines/models.py:63 games/models.py:67
msgid "wish?"
msgstr "envie de l'avoir ?"
#: figurines/models.py:62
#: figurines/models.py:64
msgid "You need this figurine."
msgstr "Vous avez besoin de cette figurine."
#: figurines/models.py:66
#: figurines/models.py:68
msgid "coins"
msgstr "monnaie"
#: figurines/models.py:73
#: figurines/models.py:75
msgid "Figurine denomination"
msgstr "Dénomination de la figurine"
#: figurines/models.py:74
#: figurines/models.py:76
msgid "Becoming set"
msgstr "Collection d'où cela provient"
#: figurines/models.py:75
#: figurines/models.py:77
msgid "Figurine progression"
msgstr "Progression de la figurine"
@ -129,7 +129,7 @@ msgstr "Progression de la figurine"
msgid "state"
msgstr "état"
#: games/admin.py:40 games/models.py:15 games/models.py:29
#: games/admin.py:40 games/admin.py:87 games/models.py:15 games/models.py:29
msgid "platform"
msgstr "plateforme"
@ -137,7 +137,7 @@ msgstr "plateforme"
msgid "Game Information"
msgstr "Information du jeu"
#: games/admin.py:79
#: games/admin.py:79 games/admin.py:117
msgid "Platform"
msgstr "Plateforme"
@ -241,29 +241,32 @@ msgstr "Nouveau statut pour ce jeu à la date donnée"
msgid "Games"
msgstr "Jeux"
#: games/templates/games/index.html:6
msgid "Now playing"
msgstr "En train d'y jouer"
#: games/templates/games/index.html:15
msgid "No playing game found."
msgstr "Aucun jeu en cours."
#: games/templates/games/index.html:17
msgid "Complete list"
msgstr "Liste complète"
#: games/templates/games/index.html:25
#: games/templates/games/index.html:13
msgid "No game found."
msgstr "Aucun jeu."
#: games/templates/games/index.html:27
#: games/templates/games/summary.html:5
msgid "My summary"
msgstr "Mon résumé"
#: games/templates/games/summary.html:6
msgid "Now playing"
msgstr "En train d'y jouer"
#: games/templates/games/summary.html:15
msgid "No playing game found."
msgstr "Aucun jeu en cours."
#: games/templates/games/summary.html:17
msgid "Memory Card"
msgstr "Carte mémoire"
#: games/templates/games/index.html:43
#: games/templates/games/summary.html:33
msgid "Empty memory."
msgstr "Mémoire vide."
#~ msgid "Complete list"
#~ msgstr "Liste complète"
#~ msgid "created"
#~ msgstr "créé"

View File

@ -3,18 +3,6 @@
{% block content %}
<h1>{% trans "Games" %}</h1>
<h2>{% trans "Now playing" %}</h2>
{% if playing_games %}
<ul>
{% for playing in playing_games %}
<li><strong>{{ playing.collection.shortname }}</strong> - {{ playing.name }}</li>
{% endfor %}
</ul>
{% else %}
<p>{% trans "No playing game found." %}</p>
{% endif %}
<h2>{% trans "Complete list" %}</h2>
{% if non_excluded_games %}
<ul>
{% for game in non_excluded_games %}
@ -24,22 +12,4 @@
{% else %}
<p>{% trans "No game found." %}</p>
{% endif %}
<h2>{% trans "Memory Card" %}</h2>
{% if last_timelines %}
{% regroup last_timelines by date as dates %}
{% for date in dates %}
<p><u>{{ date.grouper }} : </u>
<ul>
{% for timeline in date.list|dictsortreversed:"id" %}
<li>
<strong>{{ timeline.get_status_display }} :</strong> {{ timeline.item.name }}
(<strong>{{ timeline.item.collection.shortname }}</strong>)
</li>
{% endfor %}
</ul>
{% endfor %}
</p>
{% else %}
<p>{% trans "Empty memory." %}</p>
{% endif %}
{% endblock %}

View File

@ -0,0 +1,35 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<h1>{% trans "My summary" %}</h1>
<h2>{% trans "Now playing" %}</h2>
{% if playing_games %}
<ul>
{% for playing in playing_games %}
<li><strong>{{ playing.collection.shortname }}</strong> - {{ playing.name }}</li>
{% endfor %}
</ul>
{% else %}
<p>{% trans "No playing game found." %}</p>
{% endif %}
<h2>{% trans "Memory Card" %}</h2>
{% if last_timelines %}
{% regroup last_timelines by date as dates %}
{% for date in dates %}
<p><u>{{ date.grouper }} : </u>
<ul>
{% for timeline in date.list|dictsortreversed:"id" %}
<li>
<strong>{{ timeline.get_status_display }} :</strong> {{ timeline.item.name }}
(<strong>{{ timeline.item.collection.shortname }}</strong>)
</li>
{% endfor %}
</ul>
{% endfor %}
</p>
{% else %}
<p>{% trans "Empty memory." %}</p>
{% endif %}
{% endblock %}

View File

@ -1,7 +1,8 @@
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'summary/$', views.SummaryList.as_view()),
url(r'$', views.GameList.as_view()),
]
]

View File

@ -71,14 +71,20 @@ class GameList(ListView):
queryset = Game.objects.filter(~Q(status=Game.EXCLUDED) & Q(
wish=False)).order_by('name').prefetch_related('collection')
class SummaryList(ListView):
model = Game
context_object_name = 'playing_games'
template_name = 'games/summary.html'
queryset = Game.objects.filter(
playing=True).order_by('name').prefetch_related('collection')
def get_context_data(self, **kwargs):
"""
Add playing games list.
Add 5 last current activities from Timeline
"""
context = super(GameList, self).get_context_data(**kwargs)
context['playing_games'] = Game.objects.filter(
playing=True).order_by('name').prefetch_related('collection')
context = super().get_context_data(**kwargs)
context['last_timelines'] = Timeline.objects.filter(
~Q(item__status=Game.EXCLUDED)).order_by(
'-date')[:5].prefetch_related('item__collection')