Пример #1
0
class Preference(Table):

    id = orm.PrimaryKey(orm.Integer, autoincrement=True)
    created_at = orm.Column(orm.Timestamp, default=orm.utc_now())
    key = orm.Column(orm.String, length=50)
    type = orm.Column(orm.String, length=50)
    default = orm.Column(orm.Text)
Пример #2
0
class UserPreference(Table):

    id = orm.PrimaryKey(orm.Integer, autoincrement=True)
    created_at = orm.Column(orm.Timestamp, default=orm.utc_now())
    user_id = orm.ForeignKey(User.id)
    preference_id = orm.ForeignKey(Preference.id)
    value = orm.Column(orm.Text)

    preference = orm.OneToOne(preference_id)
    user = orm.OneToOne('user_preference.user_id')
Пример #3
0
class User(Table):

    id = orm.PrimaryKey(orm.Integer, autoincrement=True)
    created_at = orm.Column(orm.Timestamp, default=orm.utc_now())
    login = orm.Column(orm.String, length=50, unique=True)
    password = orm.Column(orm.String, length=60)
    firstname = orm.Column(orm.String, length=255, nullable=True)
    lastname = orm.Column(orm.String, length=255, nullable=True)
    email = orm.Column(orm.String, length=255, unique=True)
    lang = orm.Column(orm.String, length=2)
    preferences = orm.OneToMany('user_preference.user_id')
    groups = orm.ManyToMany(Group, UserGroup)
Пример #4
0
 class Test:
     field1 = orm.PrimaryKey(mock.Mock)
     field2 = orm.PrimaryKey(mock.Mock)
     field3 = orm.Column(mock.Mock)
Пример #5
0
 class Test:
     field1 = orm.PrimaryKey(mock.Mock)
Пример #6
0
class Group(Table):

    id = orm.PrimaryKey(orm.Integer, autoincrement=True)
    created_at = orm.Column(orm.Timestamp, default=orm.utc_now())
    name = orm.Column(orm.String, length=255)
    users = orm.ManyToMany('user', 'user_group')
Пример #7
0
 class Table:
     id = orm.PrimaryKey(orm.Integer)
     name = orm.Column(orm.String)
     _password = orm.Column('password', orm.String)