2018-02-04 20:20:06 +00:00
|
|
|
from core.models import Collection
|
|
|
|
from core.models import Item
|
2017-09-18 19:51:10 +00:00
|
|
|
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
|
|
|
|
"""
|
2018-02-04 20:20:06 +00:00
|
|
|
|
2017-09-18 19:51:10 +00:00
|
|
|
def __str__(self):
|
|
|
|
return '%s' % self.name
|
|
|
|
|
|
|
|
class Meta:
|
2018-02-04 20:20:06 +00:00
|
|
|
ordering = ('name', )
|
2017-09-18 19:51:10 +00:00
|
|
|
verbose_name = _('set')
|
|
|
|
verbose_name_plural = _('sets')
|
|
|
|
|
2018-02-04 20:20:06 +00:00
|
|
|
|
2017-09-18 19:51:10 +00:00
|
|
|
# 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'
|
|
|
|
|
2018-01-20 21:21:22 +00:00
|
|
|
# No more status choices than "CREATED"
|
|
|
|
|
|
|
|
# Figurines can be Character, vehicle, world or gadget (weapon)
|
|
|
|
CHARACTER = 'character'
|
|
|
|
VEHICLE = 'vehicle'
|
|
|
|
WORLD = 'world'
|
|
|
|
GADGET = 'gadget'
|
2018-02-04 20:20:06 +00:00
|
|
|
BATTLE = 'battle'
|
|
|
|
EXPANSION = 'expansion'
|
|
|
|
TROPHY = 'trophy'
|
|
|
|
TRAP = 'trap'
|
2018-01-20 21:21:22 +00:00
|
|
|
KIND_CHOICES = (
|
|
|
|
(CHARACTER, _('Character')),
|
|
|
|
(VEHICLE, _('Vehicle')),
|
2018-02-04 20:20:06 +00:00
|
|
|
(WORLD, _('Level pack')),
|
2018-01-20 21:21:22 +00:00
|
|
|
(GADGET, _('Gadget')),
|
2018-02-04 20:20:06 +00:00
|
|
|
(BATTLE, _('Battle pack')),
|
|
|
|
(EXPANSION, _('Expansion pack')),
|
|
|
|
(TROPHY, _('Trophy')),
|
|
|
|
(TRAP, _('Trap')), )
|
2018-01-20 21:21:22 +00:00
|
|
|
kind = models.CharField(
|
|
|
|
max_length=30,
|
|
|
|
choices=KIND_CHOICES,
|
|
|
|
default=CHARACTER,
|
|
|
|
verbose_name=_('kind'))
|
2017-09-18 19:51:10 +00:00
|
|
|
|
|
|
|
wish = models.BooleanField(
|
|
|
|
default=False,
|
|
|
|
verbose_name=_('wish?'),
|
|
|
|
help_text=_('You need this figurine.'))
|
|
|
|
|
2018-01-21 14:47:33 +00:00
|
|
|
# How money does your figurine have?
|
2018-02-04 20:20:06 +00:00
|
|
|
coins = models.PositiveIntegerField(
|
|
|
|
default=0, null=True, blank=True, verbose_name=_('coins'))
|
2018-01-21 14:47:33 +00:00
|
|
|
|
2017-09-18 19:51:10 +00:00
|
|
|
class Meta:
|
2018-02-04 20:20:06 +00:00
|
|
|
ordering = ('name', )
|
2017-09-18 19:51:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
# 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')
|