Example #1
0
class Member(macaron.Model):
    team = macaron.ManyToOne(Team, "members")
    first_name = macaron.CharField(max_length=40)
    last_name = macaron.CharField(max_length=40)
    age = macaron.IntegerField(max=18, min=15, default=16, null=True)
    part = macaron.CharField(max_length=10)
    joined = macaron.TimestampAtCreate()
    modified = macaron.TimestampAtSave()
Example #2
0
class MyRecord(macaron.Model):
    name = macaron.CharField(max_length=20)
    value = StoreJSON()
    created = macaron.TimestampAtCreate()
    modified = macaron.TimestampAtSave()

    def __str__(self):
        return "<MyRecord '%s' is '%s'>" % (self.name, str(self.value))
Example #3
0
class Member(macaron.Model):
    band = macaron.ManyToOne(Team,
                             null=True,
                             related_name="members",
                             on_delete="SET NULL",
                             on_update="CASCADE")
    first_name = macaron.CharField(max_length=20)
    last_name = macaron.CharField(max_length=20)
    part = macaron.CharField(max_length=10, null=True)
    code = macaron.CharField(length=6, null=True)
    age = macaron.IntegerField(max=18, min=15, default=16)
    created = macaron.TimestampAtCreate()
    joined = macaron.DateAtCreate()
    modified = macaron.TimestampAtSave()

    def __str__(self):
        return "<Member '%s %s : %s'>" % (self.first_name, self.last_name,
                                          self.part)