Nouvelle collection : les figurines

master
Olivier DOSSMANN 2017-09-18 21:51:10 +02:00
parent 0536b16d6d
commit 20a6d25a8b
14 changed files with 271 additions and 94 deletions

View File

@ -1,5 +1,6 @@
Current version (0.2) :
- Nouvelle collection de figurines
- Tests automatiques chez Gitlab
- Bug corrigé : Génération de 2 timelines si on crée un jeu avec l'état "created"
- Renommage des consoles en « plateformes »

5
TODO
View File

@ -1,5 +1,8 @@
# À faire
* Trouver des états supplémentaires aux Figurines (complétée ?)
* Ajout des Timeline sur les Figurines
* Figurine API + tests
* étudier la possibilité à l'utilisateur, via des variables d'environnement, de configurer un email, une autre BDD, etc.
## Dépôt / code
@ -8,8 +11,8 @@
## Fonctionnalités
* Ajouter la liste des aptitudes (Ability) d'une figurine
* Unplayed ne doit pas s'afficher si on a un état différent de Unfinished
* Gérer les figurines (trouver le nom de l'objet qui permet de les regrouper, par exemple Skylanders, Disney Infinity, etc.)
* ajouter une date d'obtention du jeu vidéo (par défaut aujourd'hui) => est-ce vraiment utile si on a la Timeline ?
## Tests

View File

@ -30,6 +30,7 @@ INSTALLED_APPS = [
'corsheaders',
'core',
'games.apps.GamesConfig',
'figurines.apps.FigurinesConfig',
]
MIDDLEWARE = [

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-16 21:58+0000\n"
"POT-Creation-Date: 2017-09-18 19:39+0000\n"
"PO-Revision-Date: 2017-09-16 17:16+0200\n"
"Last-Translator: Olivier DOSSMANN <git@dossmann.net>\n"
"Language-Team: \n"
@ -17,10 +17,10 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n"
#: collection/collection/components/i18n.py:8
#: collection/components/i18n.py:8
msgid "French"
msgstr "Français"
#: collection/collection/components/i18n.py:9
#: collection/components/i18n.py:9
msgid "English"
msgstr "Anglais"

View File

@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: 0.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-09-16 21:58+0000\n"
"PO-Revision-Date: 2017-09-16 23:59+0200\n"
"POT-Creation-Date: 2017-09-18 19:39+0000\n"
"PO-Revision-Date: 2017-09-18 21:23+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -17,163 +17,191 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n"
#: collection/core/models.py:7 collection/core/models.py:28
#: core/models.py:7 core/models.py:28
msgid "name"
msgstr "nom"
#: collection/core/models.py:24
#: core/models.py:24
msgid "New"
msgstr "Nouveau"
#: collection/core/models.py:48 collection/core/models.py:80
#: core/models.py:48 core/models.py:80
msgid "status"
msgstr "état"
#: collection/core/models.py:65
#: core/models.py:65
msgid "date"
msgstr "date"
#: collection/games/admin.py:11
msgid "state"
msgstr "état"
#: figurines/models.py:15 figurines/models.py:29
msgid "set"
msgstr "collection"
#: collection/games/admin.py:39
msgid "Game Information"
msgstr "Information du jeu"
#: figurines/models.py:16
msgid "sets"
msgstr "collections"
#: collection/games/admin.py:42
msgid "Progress"
msgstr "Progression"
#: figurines/models.py:19
msgid "Usual name of figurines set."
msgstr "Nom habituel de la collection de figurines."
#: collection/games/models.py:15 collection/games/models.py:29
msgid "platform"
msgstr "plateforme"
#: collection/games/models.py:16
msgid "platforms"
msgstr "plateformes"
#: collection/games/models.py:20
msgid "Most used platform name."
msgstr "Nom de plateforme le plus communément utilisé."
#: collection/games/models.py:40
msgid "Beaten"
msgstr "Terminé (quête principale)"
#: collection/games/models.py:41
msgid "Completed"
msgstr "Terminé complètement"
#: collection/games/models.py:42
msgid "Excluded"
msgstr "Exclu"
#: collection/games/models.py:43
msgid "Mastered"
msgstr "Usé / Épuisé"
#: collection/games/models.py:44
msgid "Unfinished"
msgstr "Inachevé"
#: collection/games/models.py:53
msgid "Progress note"
msgstr "Note de progression"
#: collection/games/models.py:54
msgid "Short note displayed to your followers."
msgstr "Courte note affichée à ceux qui vous suive."
#: collection/games/models.py:59
msgid "playing?"
msgstr "en train d'y jouer ?"
#: collection/games/models.py:60
msgid "You're currently playing this game."
msgstr "Vous jouez actuellement à ce jeu."
#: collection/games/models.py:63
msgid "unplayed?"
msgstr "jamais joué ?"
#: collection/games/models.py:64
msgid "You never played this game."
msgstr "Vous n'avez jamais joué à ce jeu."
#: collection/games/models.py:67
#: figurines/models.py:36 games/models.py:67
msgid "wish?"
msgstr "envie de l'avoir ?"
#: collection/games/models.py:68
#: figurines/models.py:37
msgid "You need this figurine."
msgstr "Vous avez besoin de cette figurine."
#: figurines/models.py:44
msgid "Figurine denomination"
msgstr "Dénomination de la figurine"
#: figurines/models.py:45
msgid "Becoming set"
msgstr "Collection d'où cela provient"
#: figurines/models.py:46
msgid "Figurine progression"
msgstr "Progression de la figurine"
#: games/admin.py:11
msgid "state"
msgstr "état"
#: games/admin.py:39
msgid "Game Information"
msgstr "Information du jeu"
#: games/admin.py:42
msgid "Progress"
msgstr "Progression"
#: games/models.py:15 games/models.py:29
msgid "platform"
msgstr "plateforme"
#: games/models.py:16
msgid "platforms"
msgstr "plateformes"
#: games/models.py:20
msgid "Most used platform name."
msgstr "Nom de plateforme le plus communément utilisé."
#: games/models.py:40
msgid "Beaten"
msgstr "Terminé (quête principale)"
#: games/models.py:41
msgid "Completed"
msgstr "Terminé complètement"
#: games/models.py:42
msgid "Excluded"
msgstr "Exclu"
#: games/models.py:43
msgid "Mastered"
msgstr "Usé / Épuisé"
#: games/models.py:44
msgid "Unfinished"
msgstr "Inachevé"
#: games/models.py:53
msgid "Progress note"
msgstr "Note de progression"
#: games/models.py:54
msgid "Short note displayed to your followers."
msgstr "Courte note affichée à ceux qui vous suive."
#: games/models.py:59
msgid "playing?"
msgstr "en train d'y jouer ?"
#: games/models.py:60
msgid "You're currently playing this game."
msgstr "Vous jouez actuellement à ce jeu."
#: games/models.py:63
msgid "unplayed?"
msgstr "jamais joué ?"
#: games/models.py:64
msgid "You never played this game."
msgstr "Vous n'avez jamais joué à ce jeu."
#: games/models.py:68
msgid "You're waiting X-mas father offers you this game."
msgstr "Vous patientez que le père Noël vous offre ce jeu."
#: collection/games/models.py:72
#: games/models.py:72
msgid "game"
msgstr "jeu"
#: collection/games/models.py:73
#: games/models.py:73
msgid "games"
msgstr "jeux"
#: collection/games/models.py:77
#: games/models.py:77
msgid "Game title"
msgstr "Titre du jeu"
#: collection/games/models.py:78
#: games/models.py:78
msgid "Game running platform"
msgstr "Plateforme sur laquelle se lance le jeu"
#: collection/games/models.py:79
#: games/models.py:79
msgid "Game progression"
msgstr "Progression du jeu"
#: collection/games/models.py:90
#: games/models.py:90
msgid "Timeline"
msgstr "Chronologie"
#: collection/games/models.py:91
#: games/models.py:91
msgid "Timelines"
msgstr "Chronologies"
#: collection/games/models.py:95
#: games/models.py:95
msgid "Status change date"
msgstr "Date de changement de statut"
#: collection/games/models.py:96
#: games/models.py:96
msgid "Which game?"
msgstr "Quel jeu ?"
#: collection/games/models.py:98
#: games/models.py:98
msgid "New status for this game at the given date"
msgstr "Nouveau statut pour ce jeu à la date donnée"
#: collection/games/templates/games/index.html:5
#: games/templates/games/index.html:5
msgid "Games"
msgstr "Jeux"
#: collection/games/templates/games/index.html:6
#: games/templates/games/index.html:6
msgid "Now playing"
msgstr "En train d'y jouer"
#: collection/games/templates/games/index.html:15
#: games/templates/games/index.html:15
msgid "No playing game found."
msgstr "Aucun jeu en cours."
#: collection/games/templates/games/index.html:17
#: games/templates/games/index.html:17
msgid "Complete list"
msgstr "Liste complète"
#: collection/games/templates/games/index.html:25
#: games/templates/games/index.html:25
msgid "No game found."
msgstr "Aucun jeu."
#: collection/games/templates/games/index.html:27
#: games/templates/games/index.html:27
msgid "Memory Card"
msgstr "Carte mémoire"
#: collection/games/templates/games/index.html:43
#: games/templates/games/index.html:43
msgid "Empty memory."
msgstr "Mémoire vide."

View File

View File

@ -0,0 +1,17 @@
from django.contrib import admin
from django.utils.translation import ugettext as _
from figurines.models import Set, Figurine
class FigurineInline(admin.TabularInline):
model = Figurine
fields = ('name', 'wish')
extra = 2
class SetAdmin(admin.ModelAdmin):
list_display = ('name',)
inlines = (FigurineInline,)
admin.site.register(Set, SetAdmin)

View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class FigurinesConfig(AppConfig):
name = 'figurines'

View File

@ -0,0 +1,16 @@
- model: figurines.set
pk: 1
fields:
name: Amiibo
- model: figurines.set
pk: 2
fields:
name: Disney Infinity
- model: figurines.set
pk: 3
fields:
name: Lego Dimensions
- model: figurines.set
pk: 4
fields:
name: Skylanders

View File

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.5 on 2017-09-18 19:11
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Figurine',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Figurine denomination', max_length=255, verbose_name='nom')),
('wish', models.BooleanField(default=False, help_text='You need this figurine.', verbose_name='wish?')),
('status', models.CharField(choices=[('created', 'New'), ('created', 'New')], default='created', help_text='Figurine progression', max_length=30, verbose_name='status')),
],
),
migrations.CreateModel(
name='Set',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(help_text='Usual name of figurines set.', max_length=255, verbose_name='nom')),
],
options={
'verbose_name': 'set',
'verbose_name_plural': 'sets',
'ordering': ('name',),
},
),
migrations.AddField(
model_name='figurine',
name='collection',
field=models.ForeignKey(help_text='Becoming set', on_delete=django.db.models.deletion.CASCADE, related_name='figurines', to='figurines.Set', verbose_name='set'),
),
]

View File

@ -0,0 +1,46 @@
from core.models import Collection, Item, Timeline
from django.db import models
from django.utils.translation import ugettext as _
class Set(Collection):
"""
Common name used to describe a set of characters, objects or vehicles
"""
def __str__(self):
return '%s' % self.name
class Meta:
ordering = ('name',)
verbose_name = _('set')
verbose_name_plural = _('sets')
# Redefine help_text (for documentation, API, etc.)
Set._meta.get_field('name').help_text = _('Usual name of figurines set.')
class Figurine(Item):
"""
A character, a gadget, a vehicle or a world used on a Game to use specific
levels, abilities, etc.
"""
# class config
TARGET_MODEL = 'figurines.Set'
TARGET_VERBOSE_NAME = _('set')
RELATED_TARGET_NAME = 'figurines'
# No more status choices thant "CREATED"
wish = models.BooleanField(
default=False,
verbose_name=_('wish?'),
help_text=_('You need this figurine.'))
class Meta:
ordering: ('name')
# Redefine help_text (for documentation, API, etc.)
Figurine._meta.get_field('name').help_text = _('Figurine denomination')
Figurine._meta.get_field('collection').help_text = _('Becoming set')
Figurine._meta.get_field('status').help_text = _('Figurine progression')

View File

@ -0,0 +1,17 @@
from django.test import TestCase
from figurines.models import Set
class SetTest(TestCase):
def setUp(self):
Set.objects.create(name='DimDim')
Set.objects.create(name='Rainbow')
Set.objects.create(name='Mystery')
def test_sorted_sets(self):
sets = list(Set.objects.all().values_list('name', flat=True))
sorted_sets = list(
Set.objects.all().order_by('name').values_list('name', flat=True))
self.assertEqual(sets, sorted_sets)