forked from fossasia/open-event-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpages.py
More file actions
26 lines (19 loc) · 649 Bytes
/
pages.py
File metadata and controls
26 lines (19 loc) · 649 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from flask_rest_jsonapi import ResourceDetail, ResourceList
from app.api.bootstrap import api
from app.api.schema.pages import PageSchema
from app.models import db
from app.models.page import Page
class PageList(ResourceList):
"""
List and create page
"""
decorators = (api.has_permission('is_admin', methods="POST"),)
schema = PageSchema
data_layer = {'session': db.session, 'model': Page}
class PageDetail(ResourceDetail):
"""
Page detail by id
"""
schema = PageSchema
decorators = (api.has_permission('is_admin', methods="PATCH,DELETE"),)
data_layer = {'session': db.session, 'model': Page}