Page d'accueil : ajout des activités récentes sur les jeux vidéos

master
Olivier DOSSMANN 2017-08-31 16:35:30 +02:00
parent ed9c81f0d9
commit be6b7bfc99
6 changed files with 40 additions and 14 deletions

View File

@ -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

View File

@ -13,7 +13,7 @@ TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = False
USE_L10N = True
USE_TZ = False

View File

@ -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 <git@dossmann.net>\n"
"Language-Team: \n"

View File

@ -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."

View File

@ -5,14 +5,14 @@
<h1>{% trans "Games" %}</h1>
<h2>{% trans "Now playing" %}</h2>
{% if playing_games %}
<ul>
{% for playing in playing_games%}
<li>{{ playing.name }}</li>
{% endfor %}
<ul>
{% for playing in playing_games %}
<li>{{ playing.name }}</li>
{% endfor %}
</ul>
</ul>
{% else %}
<p>{% trans "No playing game found." %}</p>
<p>{% trans "No playing game found." %}</p>
{% endif %}
<h2>{% trans "Complete list" %}</h2>
<ul>
@ -20,4 +20,17 @@
<li>{{ game.name }}</li>
{% endfor %}
</ul>
<h2>{% trans "Memory Card" %}</h2>
{% if last_timelines %}
<ul>
{% for timeline in last_timelines %}
<li>{{ timeline.date|date:"SHORT_DATE_FORMAT" }} -
<strong>{{ timeline.get_status_display }} :</strong> {{ timeline.item.name }}
({{ timeline.item.collection.name }})
</li>
{% endfor %}
</ul>
{% else %}
<p>{% trans "Empty memory." %}</p>
{% endif %}
{% endblock %}

View File

@ -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