From be6b7bfc994f2eb303fea364d9f988fd2d416e3b Mon Sep 17 00:00:00 2001 From: Olivier DOSSMANN Date: Thu, 31 Aug 2017 16:35:30 +0200 Subject: [PATCH] =?UTF-8?q?Page=20d'accueil=20:=20ajout=20des=20activit?= =?UTF-8?q?=C3=A9s=20r=C3=A9centes=20sur=20les=20jeux=20vid=C3=A9os?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG | 1 + collection/collection/components/i18n.py | 2 +- .../locale/fr/LC_MESSAGES/django.po | 2 +- .../conf/locale/fr/LC_MESSAGES/django.po | 12 +++++++-- collection/games/templates/games/index.html | 25 ++++++++++++++----- collection/games/views.py | 12 ++++++--- 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4a61715..22fce66 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ Current version (0.2) : + - Ajout d'une page d'accueil listant les jeux vidéos en cours, la liste complète et les dernières activités sur ces derniers - Nouveau champ 'note' pour la progression dans le jeu - Omission de l'état "Nouveau" pour les jeux - Traduction de l'interface en Français diff --git a/collection/collection/components/i18n.py b/collection/collection/components/i18n.py index 2f0bb9d..9c940da 100644 --- a/collection/collection/components/i18n.py +++ b/collection/collection/components/i18n.py @@ -13,7 +13,7 @@ TIME_ZONE = 'UTC' USE_I18N = True -USE_L10N = False +USE_L10N = True USE_TZ = False diff --git a/collection/collection/locale/fr/LC_MESSAGES/django.po b/collection/collection/locale/fr/LC_MESSAGES/django.po index ab1557d..348dfa0 100644 --- a/collection/collection/locale/fr/LC_MESSAGES/django.po +++ b/collection/collection/locale/fr/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-08-31 13:13+0000\n" +"POT-Creation-Date: 2017-08-31 14:31+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: Olivier DOSSMANN \n" "Language-Team: \n" diff --git a/collection/conf/locale/fr/LC_MESSAGES/django.po b/collection/conf/locale/fr/LC_MESSAGES/django.po index aaec4a2..98c4ab3 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: 2017-08-31 13:13+0000\n" -"PO-Revision-Date: 2017-08-31 15:15+0200\n" +"POT-Creation-Date: 2017-08-31 14:31+0000\n" +"PO-Revision-Date: 2017-08-31 16:32+0200\n" "Last-Translator: \n" "Language-Team: \n" "Language: fr\n" @@ -136,3 +136,11 @@ msgstr "Aucun jeu en cours." #: games/templates/games/index.html:17 msgid "Complete list" msgstr "Liste complète" + +#: games/templates/games/index.html:23 +msgid "Memory Card" +msgstr "Carte mémoire" + +#: games/templates/games/index.html:34 +msgid "Empty memory." +msgstr "Mémoire vide." diff --git a/collection/games/templates/games/index.html b/collection/games/templates/games/index.html index d9e699b..bb1d9fd 100644 --- a/collection/games/templates/games/index.html +++ b/collection/games/templates/games/index.html @@ -5,14 +5,14 @@

{% trans "Games" %}

{% trans "Now playing" %}

{% if playing_games %} - {% else %} -

{% trans "No playing game found." %}

+

{% trans "No playing game found." %}

{% endif %}

{% trans "Complete list" %}

+

{% trans "Memory Card" %}

+ {% if last_timelines %} + + {% else %} +

{% trans "Empty memory." %}

+ {% endif %} {% endblock %} \ No newline at end of file diff --git a/collection/games/views.py b/collection/games/views.py index a3ca2f9..f273bef 100644 --- a/collection/games/views.py +++ b/collection/games/views.py @@ -1,21 +1,25 @@ from django.db.models import Q from django.views.generic import ListView -from django.utils.translation import ugettext as _ -from .models import Game +from .models import Game, Timeline class GameList(ListView): model = Game context_object_name = 'non_excluded_games' template_name = 'games/index.html' - queryset = Game.objects.filter(~Q(status=Game.EXCLUDED)).order_by('name') + queryset = Game.objects.filter( + ~Q(status=Game.EXCLUDED) & + Q(wish=False)).order_by('name') def get_context_data(self, **kwargs): """ - Add playing games list + 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') + context['last_timelines'] = Timeline.objects.all().order_by( + '-date')[:5] return context \ No newline at end of file