2022/1/23
This commit is contained in:
@@ -8,8 +8,15 @@ class User(BaseModel):
|
||||
username = Column(String(20), comment='用户名')
|
||||
|
||||
|
||||
class Test(BaseModel):
|
||||
__tablename__ = 'admin_test'
|
||||
id = Column(Integer, primary_key=True, autoincrement=True, comment='ID')
|
||||
name = Column(String(20), comment='名')
|
||||
|
||||
|
||||
class Userschema(PModel):
|
||||
id: int
|
||||
username: str
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from typing import List
|
||||
|
||||
from common.view import Blueprint,View
|
||||
from common.view import Blueprint, View
|
||||
from flask import jsonify
|
||||
|
||||
from pydantic import BaseModel, ValidationError, constr, parse_obj_as
|
||||
|
||||
from modules.sys.models.user import User, Userschema
|
||||
from entrance.extend.orm import db
|
||||
from modules.sys.models.user import User, Userschema, Test
|
||||
|
||||
user = Blueprint('sys', __name__, url_prefix='/user')
|
||||
|
||||
@@ -13,7 +14,6 @@ user = Blueprint('sys', __name__, url_prefix='/user')
|
||||
@user.route('/')
|
||||
class UserView(View):
|
||||
def get(self):
|
||||
u = User.query.all()
|
||||
# m = parse_obj_as(List[User], u)
|
||||
|
||||
return '1'
|
||||
data, total = db.session.query(User.id, User.username).layui_paginate_json()
|
||||
print(data)
|
||||
return jsonify(data)
|
||||
|
||||
Reference in New Issue
Block a user