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

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

View File

@ -3,18 +3,6 @@
{% block content %} {% block content %}
<h1>{% trans "Games" %}</h1> <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 %} {% if non_excluded_games %}
<ul> <ul>
{% for game in non_excluded_games %} {% for game in non_excluded_games %}
@ -24,22 +12,4 @@
{% else %} {% else %}
<p>{% trans "No game found." %}</p> <p>{% trans "No game found." %}</p>
{% endif %} {% 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 %} {% 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 django.conf.urls import url
from . import views from . import views
urlpatterns = [ urlpatterns = [
url(r'summary/$', views.SummaryList.as_view()),
url(r'$', views.GameList.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( queryset = Game.objects.filter(~Q(status=Game.EXCLUDED) & Q(
wish=False)).order_by('name').prefetch_related('collection') 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): def get_context_data(self, **kwargs):
""" """
Add playing games list. Add playing games list.
Add 5 last current activities from Timeline Add 5 last current activities from Timeline
""" """
context = super(GameList, self).get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context['playing_games'] = Game.objects.filter(
playing=True).order_by('name').prefetch_related('collection')
context['last_timelines'] = Timeline.objects.filter( context['last_timelines'] = Timeline.objects.filter(
~Q(item__status=Game.EXCLUDED)).order_by( ~Q(item__status=Game.EXCLUDED)).order_by(
'-date')[:5].prefetch_related('item__collection') '-date')[:5].prefetch_related('item__collection')