Show More
@@ -1,24 +1,26 | |||||
1 | from sqlalchemy.ext.declarative import declarative_base |
|
1 | from sqlalchemy.ext.declarative import declarative_base | |
2 | from sqlalchemy.orm import relation, backref |
|
2 | from sqlalchemy.orm import relation, backref | |
3 | from sqlalchemy import ForeignKey, Column, Table, Sequence |
|
3 | from sqlalchemy import ForeignKey, Column, Table, Sequence | |
4 | from sqlalchemy.types import * |
|
4 | from sqlalchemy.types import * | |
5 | from sqlalchemy.databases.sqlite import * |
|
5 | from sqlalchemy.databases.sqlite import * | |
6 | from pylons_app.model.meta import Base |
|
6 | from pylons_app.model.meta import Base | |
7 |
|
7 | |||
8 |
|
8 | |||
9 | class Users(Base): |
|
9 | class Users(Base): | |
10 | __tablename__ = 'users' |
|
10 | __tablename__ = 'users' | |
11 | __table_args__ = {'useexisting':True} |
|
11 | __table_args__ = {'useexisting':True} | |
12 | user_id = Column("user_id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1) |
|
12 | user_id = Column("user_id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1) | |
13 | username = Column("username", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
13 | username = Column("username", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
14 | password = Column("password", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
14 | password = Column("password", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
15 |
active = Column("active", SL |
|
15 | active = Column("active", SLBoolean(), nullable=True, unique=None, default=None) | |
16 |
admin = Column("admin", SL |
|
16 | admin = Column("admin", SLBoolean(), nullable=True, unique=None, default=None) | |
|
17 | action_log = relation('UserLogs') | |||
17 |
|
18 | |||
18 | class UserLogs(Base): |
|
19 | class UserLogs(Base): | |
19 | __tablename__ = 'user_logs' |
|
20 | __tablename__ = 'user_logs' | |
20 | __table_args__ = {'useexisting':True} |
|
21 | __table_args__ = {'useexisting':True} | |
21 | id = Column("id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1) |
|
22 | id = Column("id", SLInteger(), nullable=False, unique=True, default=None, primary_key=1) | |
22 | user_id = Column("user_id", SLInteger(), nullable=True, unique=None, default=None) |
|
23 | user_id = Column("user_id", SLInteger(), ForeignKey(u'users.user_id'), nullable=True, unique=None, default=None) | |
23 | last_action = Column("last_action", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) |
|
24 | last_action = Column("last_action", SLText(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) | |
24 | last_action_date = Column("last_action_date", SLDateTime(timezone=False), nullable=True, unique=None, default=None) |
|
25 | last_action_date = Column("last_action_date", SLDateTime(timezone=False), nullable=True, unique=None, default=None) | |
|
26 | user = relation('Users') |
General Comments 0
You need to be logged in to leave comments.
Login now