fix #14 - Figurines : ajout de nouveaux types, parmi :

* Battle pack
  * Level pack (anciennement world)
  * Expansion pack
  * Trophy (pour les trophés Skylanders)
  * Trap (pour les pièges de cristal de Skylanders)
This commit is contained in:
2018-02-04 21:20:06 +01:00
parent bb9869df73
commit 2db9340f3d
3 changed files with 84 additions and 23 deletions

View File

@ -0,0 +1,35 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-02-04 19:34
from __future__ import unicode_literals
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
dependencies = [
('figurines', '0006_add_coins'),
]
operations = [
migrations.AlterField(
model_name='figurine',
name='kind',
field=models.CharField(
choices=[('character', 'Character'), ('vehicle', 'Vehicle'),
('world', 'Level pack'), ('gadget', 'Gadget'),
('battle', 'Battle pack'), ('expansion',
'Expansion pack'),
('trophy', 'Trophy'), ('trap', 'Trap')],
default='character',
max_length=30,
verbose_name='kind'), ),
migrations.AlterField(
model_name='figurine',
name='name',
field=models.CharField(
help_text='Figurine denomination',
max_length=255,
verbose_name='name'), ),
]

View File

@ -1,4 +1,5 @@
from core.models import Collection, Item, Timeline
from core.models import Collection
from core.models import Item
from django.db import models
from django.utils.translation import ugettext as _
@ -7,14 +8,16 @@ 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',)
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.')
@ -36,12 +39,19 @@ class Figurine(Item):
VEHICLE = 'vehicle'
WORLD = 'world'
GADGET = 'gadget'
BATTLE = 'battle'
EXPANSION = 'expansion'
TROPHY = 'trophy'
TRAP = 'trap'
KIND_CHOICES = (
(CHARACTER, _('Character')),
(VEHICLE, _('Vehicle')),
(WORLD, _('World')),
(WORLD, _('Level pack')),
(GADGET, _('Gadget')),
)
(BATTLE, _('Battle pack')),
(EXPANSION, _('Expansion pack')),
(TROPHY, _('Trophy')),
(TRAP, _('Trap')), )
kind = models.CharField(
max_length=30,
choices=KIND_CHOICES,
@ -54,11 +64,11 @@ class Figurine(Item):
help_text=_('You need this figurine.'))
# How money does your figurine have?
coins = models.PositiveIntegerField(default=0, null=True, blank=True,
verbose_name=_('coins'))
coins = models.PositiveIntegerField(
default=0, null=True, blank=True, verbose_name=_('coins'))
class Meta:
ordering = ('name',)
ordering = ('name', )
# Redefine help_text (for documentation, API, etc.)