Page d'accueil : ajout des activités récentes sur les jeux vidéos
This commit is contained in:
@ -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 %}
|
@ -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
|
Reference in New Issue
Block a user