Ajout d'une catégorisation des figurines : champ 'sorte' (kind)

This commit is contained in:
2018-01-20 22:21:22 +01:00
parent f60d7d98fd
commit b83f00609a
4 changed files with 67 additions and 9 deletions

View File

@ -5,7 +5,7 @@ from figurines.models import Set
class FigurineInline(admin.TabularInline):
model = Figurine
fields = ('name', 'wish')
fields = ('name', 'kind', 'wish')
extra = 2

View File

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.9 on 2018-01-20 20:54
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('figurines', '0003_auto_20180116_1756'),
]
operations = [
migrations.AddField(
model_name='figurine',
name='kind',
field=models.CharField(choices=[('character', 'Character'), ('vehicle', 'Vehicle'), ('world', 'World'), ('gadget', 'Gadget')], default='character', max_length=30, verbose_name='kind'),
),
]

View File

@ -29,7 +29,24 @@ class Figurine(Item):
TARGET_VERBOSE_NAME = _('set')
RELATED_TARGET_NAME = 'figurines'
# No more status choices thant "CREATED"
# No more status choices than "CREATED"
# Figurines can be Character, vehicle, world or gadget (weapon)
CHARACTER = 'character'
VEHICLE = 'vehicle'
WORLD = 'world'
GADGET = 'gadget'
KIND_CHOICES = (
(CHARACTER, _('Character')),
(VEHICLE, _('Vehicle')),
(WORLD, _('World')),
(GADGET, _('Gadget')),
)
kind = models.CharField(
max_length=30,
choices=KIND_CHOICES,
default=CHARACTER,
verbose_name=_('kind'))
wish = models.BooleanField(
default=False,