openbackloggery/collection/figurines/models.py

78 lines
2.1 KiB
Python

from core.models import Collection
from core.models import Item
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'
BATTLE = 'battle'
EXPANSION = 'expansion'
TROPHY = 'trophy'
TRAP = 'trap'
KIND_CHOICES = (
(CHARACTER, _('Character')),
(VEHICLE, _('Vehicle')),
(WORLD, _('Level pack')),
(GADGET, _('Gadget')),
(BATTLE, _('Battle pack')),
(EXPANSION, _('Expansion pack')),
(TROPHY, _('Trophy')),
(TRAP, _('Trap')), )
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.'))
# How money does your figurine have?
coins = models.PositiveIntegerField(
default=0, null=True, blank=True, verbose_name=_('coins'))
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')