JourneyJoker/partners/features.py

55 lines
1.3 KiB
Python
Raw Permalink Normal View History

2021-04-18 06:12:15 +00:00
from django.db import models
from polymorphic.models import PolymorphicModel
class FeatureSet(models.Model):
pass
class Feature(PolymorphicModel):
featureset = models.OneToOneField(FeatureSet, models.CASCADE)
comment = models.CharField(max_length=128)
@property
def name(self):
raise NotImplementedError("%s does not implement name" % self.__class__)
def icon(self):
return ""
class TimeFeature(Feature):
time = models.TimeField()
class TimeRangeFeature(Feature):
time_from = models.TimeField()
time_to = models.TimeField()
class IncludedStatus(models.IntegerChoices):
UNAVAILABLE = 0
AVAILABLE = 1
INCLUDED = 2
class IncludedFeature(Feature):
status = models.IntegerField(choices=IncludedStatus.choices)
class BedsFeature(Feature):
single = models.IntegerField()
double = models.IntegerField()
queen = models.IntegerField()
king = models.IntegerField()
couch = models.IntegerField()
class AvailableFeature(Feature):
status = models.BooleanField()
class CountFeature(Feature):
count = models.IntegerField()
class InRoomStatus(models.IntegerChoices):
UNAVAILABLE = 0
COMMON = 1
ROOM = 2
class InRoomFeature(Feature):
status = models.IntegerField(choices=InRoomStatus.choices)