예제 #1
0
            class MyMulti(Model):
                class Meta:
                    ordering = ['f1', 'f2']

                f1 = fields.IntField()
                f2 = fields.IntField()
                other = fields.StringField()
예제 #2
0
        class MyModel( Model ):
            class Meta:
                storage = FooStorage

            int_type = fields.IntField(primary_key=True)
            str_type = fields.StringField()
            date_type  = fields.DateTimeField()
예제 #3
0
        class MyModel( Model ):

            class Meta:
                filename = 'foo.bar'

            int_type = fields.IntField(primary_key=True)
            str_type = fields.StringField()
            date_type  = fields.DateTimeField()
예제 #4
0
        class MyModel( Model ):
            class Meta:
                ordering = ['int_type','str_type','dt_type']
                filename = tfile.name

            int_type = fields.IntField(primary_key=True)
            str_type = fields.StringField()
            dt_type  = fields.DateTimeField()
예제 #5
0
class MyModel(Model):
    class Meta:
        ordering = ['int_type', 'str_type', 'dt_type']

    int_type = fields.IntField(primary_key=True)
    str_type = fields.StringField()
    dt_type = fields.DateTimeField()

    @property
    def iter_type(self):
        return [self.int_type]
예제 #6
0
파일: rssfeed.py 프로젝트: kneufeld/alkali
class Episode(alkali.Model):

    class Meta:
        storage = RssLoader('https://pythonbytes.fm/episodes/rss')

    guid           = fields.UUIDField(primary_key=True)
    title          = fields.StringField()
    published      = fields.DateTimeField()
    itunes_episode = fields.IntField()
    link           = fields.StringField()
    description    = fields.StringField()

    def __str__(self):
        return f"<Epsiode {self.itunes_episode} - {self.title}>"

    @property
    def num(self):
        return self.itunes_episode
예제 #7
0
class AutoModel2(Model):
    auto = fields.IntField(primary_key=True, auto_increment=True)
    creation = fields.DateTimeField(auto_now_add=True)
    modified = fields.DateTimeField(auto_now=True)
    f1 = fields.StringField()
    f2 = fields.StringField()
예제 #8
0
class MyDepModel(Model):
    pk1 = fields.IntField(primary_key=True)
    foreign = fields.ForeignKey(MyModel)
예제 #9
0
class MyMulti(Model):
    pk1 = fields.IntField(primary_key=True)
    pk2 = fields.IntField(primary_key=True)
    other = fields.StringField()
예제 #10
0
        class MyModel2(Model):
            class Meta:
                storage = FooStorage

            pk1     = fields.IntField(primary_key=True)
예제 #11
0
        class MyModel2( Model ):
            class Meta:
                filename = tfile.name

            int_type = fields.IntField(primary_key=True)