コード例 #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()
コード例 #2
0
ファイル: test_basic.py プロジェクト: zhenruyan/macaron
class Member(macaron.Model):
    team = macaron.ManyToOne(Team, related_name="members")
    first_name = macaron.CharField(max_length=20, null=True)
    last_name = macaron.CharField(max_length=20, null=True)
    part = macaron.CharField(max_length=10, null=True)
    age = macaron.IntegerField(null=True)

    def __str__(self):
        return "<Member '%s %s : %s'>" % (self.first_name, self.last_name,
                                          self.part)
コード例 #3
0
ファイル: test_class_attr.py プロジェクト: zhenruyan/macaron
class Team(macaron.Model):
    name = macaron.CharField(max_length=50)
    created = macaron.TimestampAtCreate()
    start_date = macaron.DateAtCreate()

    def __str__(self):
        return "<Team '%s'>" % self.name
コード例 #4
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))
コード例 #5
0
ファイル: models.py プロジェクト: zhenruyan/macaron
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)
コード例 #6
0
class Group(macaron.Model):
    name     = macaron.CharField(max_length=20)
    series   = macaron.ManyToOne(Series, related_name="groups")
コード例 #7
0
class Movie(macaron.Model): title = macaron.CharField(max_length=20)

class Group(macaron.Model):
コード例 #8
0
class Series(macaron.Model): name = macaron.CharField(max_length=30)
class Movie(macaron.Model): title = macaron.CharField(max_length=20)
コード例 #9
0
class SubTitle(macaron.Model):
    title = macaron.CharField(max_length=30)
    movie = macaron.ManyToOne(Movie, related_name="subtitles", on_delete="CASCADE")
コード例 #10
0
class Member(macaron.Model):
    curename = macaron.CharField(max_length=30)
    mygroup  = macaron.ManyToOne(Group, related_name="mymembers")
    subgroup = macaron.ManyToOne(Group, related_name="submembers")
    movies   = macaron.ManyToMany(Movie, related_name="members")
    joined   = macaron.DateField()
コード例 #11
0
ファイル: project.py プロジェクト: olsenb/CodeSchool
class Challenges(macaron.Model):
    title = macaron.CharField()
    description = macaron.CharField()
    image_url = macaron.CharField()
    skill = macaron.ManyToOne(Skills, related_name="skill")
コード例 #12
0
ファイル: project.py プロジェクト: olsenb/CodeSchool
class Skills(macaron.Model):
    title = macaron.CharField()
    description = macaron.CharField()
    url = macaron.CharField()
    image_path = macaron.CharField()
コード例 #13
0
ファイル: test_basic.py プロジェクト: zhenruyan/macaron
class Team(macaron.Model):
    name = macaron.CharField(max_length=20)

    def __str__(self):
        return "<Team '%s'>" % self.name
コード例 #14
0
ファイル: models.py プロジェクト: zhenruyan/macaron
class Song(macaron.Model):
    name = macaron.CharField(max_length=50)
    members = macaron.ManyToMany(Member, related_name="songs")