Exemplo n.º 1
0
class MockModel(object):
    """ Mock Model """

    _pk = fields.AutoField(name='id')

    @classmethod
    def get(*args, **kwargs):
        return MockModel()
Exemplo n.º 2
0
    class Book(models.Model):
        __tablename__ = 'good_books'

        id = fields.AutoField()
        author = fields.ForeignKeyField(Author,
                                        'books',
                                        is_nullable=True,
                                        on_delete=sql.CASCADE)
        title = fields.CharField(default='Title')
        pages = fields.IntegerField(default=100)
        coauthor = fields.ForeignKeyField(Author,
                                          'cobooks',
                                          is_nullable=True,
                                          on_delete=sql.NO_ACTION)
        rating = fields.IntegerField(default=10)
        name = fields.CharField(default='Book name')
Exemplo n.º 3
0
 class BaseModel(models.Model):
     id = fields.AutoField()
Exemplo n.º 4
0
    class Author(models.Model):

        id = fields.AutoField()
        name = fields.CharField()
Exemplo n.º 5
0
 class Model(models.Model):
     query_manager = 'Mock'
     id = fields.AutoField()