Ajout du champ "shortname" sur les collections

This commit is contained in:
Olivier DOSSMANN 2018-01-15 18:55:03 +01:00
parent 50f0361b91
commit a6dcad77d9
7 changed files with 81 additions and 19 deletions

View File

@ -7,7 +7,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-09-18 19:39+0000\n" "POT-Creation-Date: 2018-01-15 17:37+0000\n"
"PO-Revision-Date: 2017-09-16 17:16+0200\n" "PO-Revision-Date: 2017-09-16 17:16+0200\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

@ -7,29 +7,33 @@ 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-09-18 19:39+0000\n" "POT-Creation-Date: 2018-01-15 17:37+0000\n"
"PO-Revision-Date: 2017-09-18 21:23+0200\n" "PO-Revision-Date: 2018-01-15 18:38+0100\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: fr\n" "Language: fr\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.3\n" "X-Generator: Poedit 2.0.5\n"
#: core/models.py:7 core/models.py:28 #: core/models.py:7 core/models.py:29
msgid "name" msgid "name"
msgstr "nom" msgstr "nom"
#: core/models.py:24 #: core/models.py:8
msgid "shortname"
msgstr "nom court"
#: core/models.py:25
msgid "New" msgid "New"
msgstr "Nouveau" msgstr "Nouveau"
#: core/models.py:48 core/models.py:80 #: core/models.py:49 core/models.py:81
msgid "status" msgid "status"
msgstr "état" msgstr "état"
#: core/models.py:65 #: core/models.py:66
msgid "date" msgid "date"
msgstr "date" msgstr "date"

View File

@ -1,10 +1,12 @@
from datetime import datetime from datetime import datetime
from django.db import models from django.db import models
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
class Collection(models.Model): class Collection(models.Model):
name = models.CharField(max_length=255, verbose_name=_('name')) name = models.CharField(max_length=255, verbose_name=_('name'))
shortname = models.CharField(max_length=30, verbose_name=_('shortname'))
def __str__(self): def __str__(self):
return '%s' % self.name return '%s' % self.name
@ -20,9 +22,7 @@ class Item(models.Model):
# status choices # status choices
CREATED = 'created' CREATED = 'created'
STATUS_CHOICES = ( STATUS_CHOICES = ((CREATED, _('New')), )
(CREATED, _('New')),
)
DEFAULT_CHOICE = CREATED DEFAULT_CHOICE = CREATED
name = models.CharField(max_length=255, verbose_name=_('name')) name = models.CharField(max_length=255, verbose_name=_('name'))
@ -70,8 +70,7 @@ class Timeline(models.Model):
Add new field 'item' which is a link to TARGET_MODEL Add new field 'item' which is a link to TARGET_MODEL
""" """
target_field = models.ForeignKey( target_field = models.ForeignKey(
cls.TARGET_MODEL, cls.TARGET_MODEL, verbose_name=_(cls.TARGET_VERBOSE_NAME))
verbose_name=_(cls.TARGET_VERBOSE_NAME))
target_field.contribute_to_class(cls, 'item') target_field.contribute_to_class(cls, 'item')
status_field = models.CharField( status_field = models.CharField(
max_length=30, max_length=30,
@ -81,11 +80,9 @@ class Timeline(models.Model):
status_field.contribute_to_class(cls, 'status') status_field.contribute_to_class(cls, 'status')
def __str__(self): def __str__(self):
return '%s: %s - %s' % ( return '%s: %s - %s' % (self.date.strftime('%Y-%m-%d'), self.status,
self.date.strftime('%Y-%m-%d'), self.item)
self.status,
self.item)
class Meta: class Meta:
abstract = True abstract = True
ordering = ('-date',) ordering = ('-date', )

View File

@ -2,15 +2,19 @@
pk: 1 pk: 1
fields: fields:
name: Amiibo name: Amiibo
shortname: Amiibo
- model: figurines.set - model: figurines.set
pk: 2 pk: 2
fields: fields:
name: Disney Infinity name: Disney Infinity
shortname: Infinity
- model: figurines.set - model: figurines.set
pk: 3 pk: 3
fields: fields:
name: Lego Dimensions name: Lego Dimensions
shortname: LD
- model: figurines.set - model: figurines.set
pk: 4 pk: 4
fields: fields:
name: Skylanders name: "Skylanders Serie 1: Spyro's adventure"
shortname: Skylanders

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-15 17:30
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('figurines', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='set',
name='shortname',
field=models.CharField(
default='TODO: Add shortname',
max_length=30,
verbose_name='shortname'), ),
]

View File

@ -2,43 +2,54 @@
pk: 1 pk: 1
fields: fields:
name: Steam name: Steam
shortname: Steam
- model: games.platform - model: games.platform
pk: 2 pk: 2
fields: fields:
name: Game Boy name: Game Boy
shortname: Game Boy
- model: games.platform - model: games.platform
pk: 3 pk: 3
fields: fields:
name: Nintendo 3DS name: Nintendo 3DS
shortname: 3DS
- model: games.platform - model: games.platform
pk: 4 pk: 4
fields: fields:
name: Nintendo Switch name: Nintendo Switch
shortname: Switch
- model: games.platform - model: games.platform
pk: 5 pk: 5
fields: fields:
name: PC name: PC
shortname: PC
- model: games.platform - model: games.platform
pk: 6 pk: 6
fields: fields:
name: Genesis / Mega Drive name: Genesis / Mega Drive
shortname: GEN
- model: games.platform - model: games.platform
pk: 7 pk: 7
fields: fields:
name: Nintendo Entertainment System name: Nintendo Entertainment System
shortname: NES
- model: games.platform - model: games.platform
pk: 8 pk: 8
fields: fields:
name: PlayStation name: PlayStation
shortname: PS
- model: games.platform - model: games.platform
pk: 9 pk: 9
fields: fields:
name: PlayStation 3 name: PlayStation 3
shortname: PS3
- model: games.platform - model: games.platform
pk: 10 pk: 10
fields: fields:
name: PlayStation 4 name: PlayStation 4
shortname: PS4
- model: games.platform - model: games.platform
pk: 11 pk: 11
fields: fields:
name: Wii name: Wii
shortname: Wii

View File

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-15 17:30
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('games', '0009_add_help_text_for_documentation'),
]
operations = [
migrations.AddField(
model_name='platform',
name='shortname',
field=models.CharField(
default='TODO: Add shortname',
max_length=30,
verbose_name='shortname'), ),
]