fix(修复模型名)
This commit is contained in:
+3
-3
@@ -1,4 +1,4 @@
|
||||
from .file import PhotoModels
|
||||
from .rights import RightModels, RoleModels
|
||||
from .file import PhotoModel
|
||||
from .rights import RightModel, RoleModel
|
||||
from .system import LogModel
|
||||
from .users import UserModels, DepartmentModels
|
||||
from .users import UserModel, DepartmentModel
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ from datetime import datetime
|
||||
from extensions import db
|
||||
|
||||
|
||||
class PhotoModels(db.Model):
|
||||
class PhotoModel(db.Model):
|
||||
__tablename__ = 'file_photo'
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
name = db.Column(db.String(255), nullable=False)
|
||||
|
||||
+4
-4
@@ -17,7 +17,7 @@ role_power = db.Table(
|
||||
)
|
||||
|
||||
|
||||
class RightModels(db.Model):
|
||||
class RightModel(db.Model):
|
||||
__tablename__ = 'rt_power'
|
||||
id = db.Column(db.Integer, primary_key=True, comment='权限编号')
|
||||
name = db.Column(db.String(255), comment='权限名称')
|
||||
@@ -30,10 +30,10 @@ class RightModels(db.Model):
|
||||
sort = db.Column(db.Integer, comment='排序')
|
||||
enable = db.Column(db.Boolean, comment='是否开启')
|
||||
|
||||
parent = db.relationship("RightModels", remote_side=[id]) # 自关联
|
||||
parent = db.relationship("RightModel", remote_side=[id]) # 自关联
|
||||
|
||||
|
||||
class RoleModels(db.Model):
|
||||
class RoleModel(db.Model):
|
||||
__tablename__ = 'rt_role'
|
||||
id = db.Column(db.Integer, primary_key=True, comment='角色ID')
|
||||
name = db.Column(db.String(255), comment='角色名称')
|
||||
@@ -43,4 +43,4 @@ class RoleModels(db.Model):
|
||||
details = db.Column(db.String(255), comment='详情')
|
||||
sort = db.Column(db.Integer, comment='排序')
|
||||
|
||||
power = db.relationship('RightModels', secondary="rt_role_power", backref=db.backref('role'))
|
||||
power = db.relationship('RightModel', secondary="rt_role_power", backref=db.backref('role'))
|
||||
|
||||
+3
-3
@@ -6,7 +6,7 @@ from werkzeug.security import generate_password_hash, check_password_hash
|
||||
from extensions import db
|
||||
|
||||
|
||||
class UserModels(db.Model, UserMixin):
|
||||
class UserModel(db.Model, UserMixin):
|
||||
__tablename__ = 'cp_user'
|
||||
id = db.Column(db.Integer, primary_key=True, autoincrement=True, comment='用户ID')
|
||||
username = db.Column(db.String(20), comment='用户名')
|
||||
@@ -18,7 +18,7 @@ class UserModels(db.Model, UserMixin):
|
||||
enable = db.Column(db.Integer, default=0, comment='启用')
|
||||
dept_id = db.Column(db.Integer, comment='部门id')
|
||||
|
||||
role = db.relationship('RoleModels', secondary="rt_user_role", backref=db.backref('user'), lazy='dynamic')
|
||||
role = db.relationship('RoleModel', secondary="rt_user_role", backref=db.backref('user'), lazy='dynamic')
|
||||
|
||||
def set_password(self, password):
|
||||
"""设置密码,对密码进行加密存储"""
|
||||
@@ -32,7 +32,7 @@ class UserModels(db.Model, UserMixin):
|
||||
update_at = db.Column(db.DateTime, default=datetime.now, onupdate=datetime.now, comment='更新时间')
|
||||
|
||||
|
||||
class DepartmentModels(db.Model):
|
||||
class DepartmentModel(db.Model):
|
||||
__tablename__ = 'cp_dept'
|
||||
id = db.Column(db.Integer, primary_key=True, comment="部门ID")
|
||||
parent_id = db.Column(db.Integer, comment="父级编号")
|
||||
|
||||
Reference in New Issue
Block a user