示例#1
0
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']]
示例#2
0
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='')
示例#3
0
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) + ")>"
示例#4
0
class WizardFan(Versionable):
    name = CharField(max_length=200)
    team = VersionedForeignKey(Team, null=True, on_delete=PROTECT)

    __str__ = versionable_description
示例#5
0
class RabidFan(Versionable):
    name = CharField(max_length=200)
    team = VersionedForeignKey(Team, null=True, on_delete=SET_NULL)

    __str__ = versionable_description
示例#6
0
class Fan(Versionable):
    name = CharField(max_length=200)
    team = VersionedForeignKey(Team, null=False, on_delete=SET(default_team))

    __str__ = versionable_description
示例#7
0
class Mascot(Versionable):
    name = CharField(max_length=200)
    team = VersionedForeignKey(Team, null=False)

    __str__ = versionable_description
示例#8
0
class Player(Versionable):
    name = CharField(max_length=200)
    team = VersionedForeignKey(Team, null=True)

    __str__ = versionable_description
示例#9
0
class Team(Versionable):
    name = CharField(max_length=200)
    city = VersionedForeignKey(City, null=True)

    __str__ = versionable_description
示例#10
0
class Directory(Versionable):
    name = CharField(max_length=100)
    parent = VersionedForeignKey('self', null=True)
示例#11
0
class NonFan(Versionable):
    name = CharField(max_length=200)
    team = VersionedForeignKey(Team, null=False, on_delete=DO_NOTHING)

    __str__ = versionable_description