class ChainStore(Versionable): subchain_id = IntegerField() city = CharField(max_length=40) name = CharField(max_length=40) opening_hours = CharField(max_length=40) door_frame_color = VersionedForeignKey('Color') door_color = VersionedForeignKey('Color', related_name='cs') # There are lots of these chain stores. They follow these rules: # - only one store with the same name and subchain_id can exist in a # single city # - no two stores can share the same door_frame_color and door_color # Yea, well, they want to appeal to people who want to be different. VERSION_UNIQUE = [['subchain_id', 'city', 'name'], ['door_frame_color', 'door_color']]
class Dataset(Versionable): job = VersionedForeignKey(Job, on_delete=models.CASCADE, related_name='datasets') name = models.CharField(max_length=255, default='') description = models.TextField(default='') current_json = models.TextField(default='')
class WineDrinkerHat(Model): shape_choices = [('Sailor', 'Sailor'), ('Cloche', 'Cloche'), ('Cartwheel', 'Cartwheel'), ('Turban', 'Turban'), ('Breton', 'Breton'), ('Vagabond', 'Vagabond')] color = CharField(max_length=40) shape = CharField(max_length=200, choices=shape_choices, default='Sailor') wearer = VersionedForeignKey(WineDrinker, related_name='hats', null=True) def __str__(self): return "<" + str(self.__class__.__name__) + " object: " + str( self.shape) + " (" + str(self.color) + ")>"
class WizardFan(Versionable): name = CharField(max_length=200) team = VersionedForeignKey(Team, null=True, on_delete=PROTECT) __str__ = versionable_description
class RabidFan(Versionable): name = CharField(max_length=200) team = VersionedForeignKey(Team, null=True, on_delete=SET_NULL) __str__ = versionable_description
class Fan(Versionable): name = CharField(max_length=200) team = VersionedForeignKey(Team, null=False, on_delete=SET(default_team)) __str__ = versionable_description
class Mascot(Versionable): name = CharField(max_length=200) team = VersionedForeignKey(Team, null=False) __str__ = versionable_description
class Player(Versionable): name = CharField(max_length=200) team = VersionedForeignKey(Team, null=True) __str__ = versionable_description
class Team(Versionable): name = CharField(max_length=200) city = VersionedForeignKey(City, null=True) __str__ = versionable_description
class Directory(Versionable): name = CharField(max_length=100) parent = VersionedForeignKey('self', null=True)
class NonFan(Versionable): name = CharField(max_length=200) team = VersionedForeignKey(Team, null=False, on_delete=DO_NOTHING) __str__ = versionable_description