Ajout d'une page d'accueil listant la collection

This commit is contained in:
Olivier DOSSMANN 2017-08-31 15:20:08 +02:00
parent 5ba6193d4b
commit 5867d70111
7 changed files with 96 additions and 19 deletions

View File

@ -8,7 +8,7 @@ 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: 2017-08-25 22:18+0000\n" "POT-Creation-Date: 2017-08-31 13:13+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Olivier DOSSMANN <git@dossmann.net>\n" "Last-Translator: Olivier DOSSMANN <git@dossmann.net>\n"
"Language-Team: \n" "Language-Team: \n"

View File

@ -13,15 +13,17 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
""" """
from django.conf.urls import url from django.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
from collection import __version__ as app_version from collection import __version__ as app_version
from games.views import GameList
# Admin config # Admin config
admin.site.site_title = 'OpenBackloggery' admin.site.site_title = 'OpenBackloggery'
admin.site.site_header = '%s %s' % (admin.site.site_title, app_version) admin.site.site_header = '%s %s' % (admin.site.site_title, app_version)
urlpatterns = [ urlpatterns = [
url(r'^$', GameList.as_view(), name='homepage'),
url(r'^games/', include('games.urls', namespace='games'), name='games'),
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
] ]

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: 2017-08-25 22:18+0000\n" "POT-Creation-Date: 2017-08-31 13:13+0000\n"
"PO-Revision-Date: 2017-08-26 00:21+0200\n" "PO-Revision-Date: 2017-08-31 15:15+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
@ -73,50 +73,66 @@ msgstr "Usé / Épuisé"
msgid "Unfinished" msgid "Unfinished"
msgstr "Inachevé" msgstr "Inachevé"
#: games/models.py:48 #: games/models.py:49
msgid "Progress note" msgid "Progress note"
msgstr "Note de progression" msgstr "Note de progression"
#: games/models.py:49 #: games/models.py:50
msgid "Short note displayed to your followers." msgid "Short note displayed to your followers."
msgstr "Courte note affichée à ceux qui vous suive" msgstr "Courte note affichée à ceux qui vous suive"
#: games/models.py:54 #: games/models.py:55
msgid "playing?" msgid "playing?"
msgstr "en train d'y jouer ?" msgstr "en train d'y jouer ?"
#: games/models.py:55 #: games/models.py:56
msgid "You're currently playing this game." msgid "You're currently playing this game."
msgstr "Vous jouez actuellement à ce jeu." msgstr "Vous jouez actuellement à ce jeu."
#: games/models.py:58 #: games/models.py:59
msgid "unplayed?" msgid "unplayed?"
msgstr "jamais joué ?" msgstr "jamais joué ?"
#: games/models.py:59 #: games/models.py:60
msgid "You never played this game." msgid "You never played this game."
msgstr "Vous n'avez jamais joué à ce jeu." msgstr "Vous n'avez jamais joué à ce jeu."
#: games/models.py:62 #: games/models.py:63
msgid "wish?" msgid "wish?"
msgstr "envie de l'avoir ?" msgstr "envie de l'avoir ?"
#: games/models.py:63 #: games/models.py:64
msgid "You're waiting X-mas father offers you this game." msgid "You're waiting X-mas father offers you this game."
msgstr "Vous patientez que le père Noël vous offre ce jeu." msgstr "Vous patientez que le père Noël vous offre ce jeu."
#: games/models.py:67 #: games/models.py:68
msgid "game" msgid "game"
msgstr "jeu" msgstr "jeu"
#: games/models.py:68 #: games/models.py:69
msgid "games" msgid "games"
msgstr "jeux" msgstr "jeux"
#: games/models.py:79 #: games/models.py:80
msgid "Timeline" msgid "Timeline"
msgstr "Chronologie" msgstr "Chronologie"
#: games/models.py:80 #: games/models.py:81
msgid "Timelines" msgid "Timelines"
msgstr "Chronologies" msgstr "Chronologies"
#: games/templates/games/index.html:5
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"

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
{% load i18n %}{% get_current_language as LANGUAGE_CODE %}<html lang="{{ LANGUAGE_CODE }}">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>OpenBackloggery</title>
</head>
<body>
{% block content %}
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,23 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<h1>{% trans "Games" %}</h1>
<h2>{% trans "Now playing" %}</h2>
{% if playing_games %}
<ul>
{% for playing in playing_games%}
<li>{{ playing.name }}</li>
{% endfor %}
</ul>
{% else %}
<p>{% trans "No playing game found." %}</p>
{% endif %}
<h2>{% trans "Complete list" %}</h2>
<ul>
{% for game in non_excluded_games %}
<li>{{ game.name }}</li>
{% endfor %}
</ul>
{% endblock %}

7
collection/games/urls.py Normal file
View File

@ -0,0 +1,7 @@
from django.conf.urls import url
from . import views
urlpatterns = [
url(r'$', views.GameList.as_view()),
]

View File

@ -1,3 +1,21 @@
from django.shortcuts import render from django.db.models import Q
from django.views.generic import ListView
from django.utils.translation import ugettext as _
# Create your views here. from .models import Game
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')
def get_context_data(self, **kwargs):
"""
Add playing games list
"""
context = super(GameList, self).get_context_data(**kwargs)
context['playing_games'] = Game.objects.filter(
playing=True).order_by('name')
return context