From c9e9ec46fa7c591cf73ab4c9565fd9ae82d7ce81 Mon Sep 17 00:00:00 2001
From: Olivier DOSSMANN
Date: Mon, 19 Feb 2018 22:21:06 +0100
Subject: [PATCH] =?UTF-8?q?S=C3=A9paration=20de=20la=20liste=20des=20jeux?=
=?UTF-8?q?=20avec=20les=20jeux=20en=20cours=20+=20Timelines?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../conf/locale/fr/LC_MESSAGES/django.po | 77 ++++++++++---------
collection/games/templates/games/index.html | 30 --------
collection/games/templates/games/summary.html | 35 +++++++++
collection/games/urls.py | 5 +-
collection/games/views.py | 12 ++-
5 files changed, 87 insertions(+), 72 deletions(-)
create mode 100644 collection/games/templates/games/summary.html
diff --git a/collection/conf/locale/fr/LC_MESSAGES/django.po b/collection/conf/locale/fr/LC_MESSAGES/django.po
index 92e717a..f1032db 100644
--- a/collection/conf/locale/fr/LC_MESSAGES/django.po
+++ b/collection/conf/locale/fr/LC_MESSAGES/django.po
@@ -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éé"
diff --git a/collection/games/templates/games/index.html b/collection/games/templates/games/index.html
index b152b13..2a3acab 100644
--- a/collection/games/templates/games/index.html
+++ b/collection/games/templates/games/index.html
@@ -3,18 +3,6 @@
{% block content %}
{% trans "Games" %}
- {% trans "Now playing" %}
- {% if playing_games %}
-
- {% for playing in playing_games %}
- - {{ playing.collection.shortname }} - {{ playing.name }}
- {% endfor %}
-
-
- {% else %}
- {% trans "No playing game found." %}
- {% endif %}
- {% trans "Complete list" %}
{% if non_excluded_games %}
- {% else %}
- {% trans "Empty memory." %}
- {% endif %}
{% endblock %}
diff --git a/collection/games/templates/games/summary.html b/collection/games/templates/games/summary.html
new file mode 100644
index 0000000..14e61a4
--- /dev/null
+++ b/collection/games/templates/games/summary.html
@@ -0,0 +1,35 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+ {% trans "My summary" %}
+ {% trans "Now playing" %}
+ {% if playing_games %}
+
+ {% for playing in playing_games %}
+ - {{ playing.collection.shortname }} - {{ playing.name }}
+ {% endfor %}
+
+
+ {% else %}
+ {% trans "No playing game found." %}
+ {% endif %}
+ {% trans "Memory Card" %}
+ {% if last_timelines %}
+ {% regroup last_timelines by date as dates %}
+ {% for date in dates %}
+ {{ date.grouper }} :
+
+ {% for timeline in date.list|dictsortreversed:"id" %}
+ -
+ {{ timeline.get_status_display }} : {{ timeline.item.name }}
+ ({{ timeline.item.collection.shortname }})
+
+ {% endfor %}
+
+ {% endfor %}
+
+ {% else %}
+ {% trans "Empty memory." %}
+ {% endif %}
+{% endblock %}
diff --git a/collection/games/urls.py b/collection/games/urls.py
index a62f92f..f943b20 100644
--- a/collection/games/urls.py
+++ b/collection/games/urls.py
@@ -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()),
-]
\ No newline at end of file
+]
diff --git a/collection/games/views.py b/collection/games/views.py
index 9e30fdb..0fa1f35 100644
--- a/collection/games/views.py
+++ b/collection/games/views.py
@@ -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')