openbackloggery/collection/figurines/models.py

64 lines
1.7 KiB
Python

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 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,
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')