Exemplo n.º 1
0
            class MyMulti(Model):
                class Meta:
                    ordering = ['f1', 'f2']

                f1 = fields.IntField()
                f2 = fields.IntField()
                other = fields.StringField()
Exemplo n.º 2
0
        class MyModel( Model ):
            class Meta:
                storage = FooStorage

            int_type = fields.IntField(primary_key=True)
            str_type = fields.StringField()
            date_type  = fields.DateTimeField()
Exemplo n.º 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()
Exemplo n.º 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()
Exemplo n.º 5
0
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
Exemplo n.º 6
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]
Exemplo n.º 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()
Exemplo n.º 8
0
class AuxInfo(Model):
    entry = fields.ForeignKey(Entry, primary_key=True)
    entry2 = fields.ForeignKey(Entry2)
    mime_type = fields.StringField()
Exemplo n.º 9
0
class MyMulti(Model):
    pk1 = fields.IntField(primary_key=True)
    pk2 = fields.IntField(primary_key=True)
    other = fields.StringField()