本文整理汇总了Python中flask_peewee.rest.RestAPI.setup方法的典型用法代码示例。如果您正苦于以下问题:Python RestAPI.setup方法的具体用法?Python RestAPI.setup怎么用?Python RestAPI.setup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类flask_peewee.rest.RestAPI
的用法示例。
在下文中一共展示了RestAPI.setup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_api
# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
def setup_api(auth):
user_auth = UserAuthentication(auth)
api = RestAPI(app, default_auth=user_auth)
api.register(Note)
api.register(Author)
api.setup()
return api
示例2: initialize
# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
def initialize():
global db, api
db = Database(app)
# Setup models
import models
models.setup()
# Register REST api
api = RestAPI(app)
api.register(models.Flow)
api.setup()
示例3: homepage
# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
api.register(Message, RestrictOwnerResource)
api.register(User, UserResource, auth=admin_auth)
api.register(Note)
api.register(TestModel, auth=api_key_auth)
api.register(AModel, AResource, auth=dummy_auth)
api.register(BModel, BResource, auth=dummy_auth)
api.register(CModel, CResource, auth=dummy_auth)
api.register(EModel, EResource, auth=dummy_auth)
api.register(FModel, FResource, auth=dummy_auth)
# views
@app.route('/')
def homepage():
return Response()
@app.route('/private/')
@auth.login_required
def private_timeline():
return Response()
@app.route('/secret/')
@auth.admin_required
def secret_area():
return Response()
admin.setup()
api.setup()
示例4: ForeignKeyField
# 需要导入模块: from flask_peewee.rest import RestAPI [as 别名]
# 或者: from flask_peewee.rest.RestAPI import setup [as 别名]
enfermeiro = ForeignKeyField(Enfermeiro, related_name='pacientes', null=True)
sala = ForeignKeyField(Sala, related_name='pacientes', null=True)
modeloAgendamento = ForeignKeyField(ModeloAgendamento, null=True)
class AvaliacaoEscalaBraden(db.Model):
paciente = ForeignKeyField(Paciente, related_name='avaliacoes')
sala = ForeignKeyField(Sala, related_name='avaliacoes')
enfermeiro = ForeignKeyField(Enfermeiro, related_name='avaliacoes')
data = DateTimeField();
status = IntegerField()
percepcaoSensorial = IntegerField()
umidade = IntegerField()
atividade = IntegerField()
mobilidade = IntegerField()
nutricao = IntegerField()
friccao = IntegerField()
class Calendario(db.Model):
dia = DateTimeField()
class CalendarioDetalhe(db.Model):
calendario = ForeignKeyField(Calendario, related_name='detalhes')
paciente = ForeignKeyField(Paciente)
avaliacao = ForeignKeyField(AvaliacaoEscalaBraden, null=True)
restApi = RestAPI(app)
restApi.register(AvaliacaoEscalaBraden)
restApi.register(Sala)
restApi.setup()