2020-07-08 14:36:13 +02:00
|
|
|
"""
|
|
|
|
!!!AUTOGENERATED: DO NOT EDIT!!!
|
|
|
|
|
|
|
|
Edit the hooks in webapp/routes/blog_post_hooks.py instead
|
|
|
|
"""
|
|
|
|
|
2021-05-15 01:04:17 +02:00
|
|
|
from flask import render_template
|
|
|
|
from flask_security import login_required
|
|
|
|
|
2020-07-08 14:36:13 +02:00
|
|
|
from oshipka.webapp import app
|
|
|
|
from oshipka.webapp.views import ModelView
|
|
|
|
from webapp.routes.blog_post_hooks import *
|
2021-05-15 01:04:17 +02:00
|
|
|
from webapp.models import BlogPost
|
|
|
|
|
|
|
|
|
|
|
|
blog_post = ModelView(app, BlogPost, {'name': 'BlogPost', 'searchable': ['body'], 'inherits': ['Ownable'], 'access': [{'verb': 'all', 'login_required': True, 'roles_required': ['admin']}, {'verb': 'get', 'login_required': False}, {'verb': 'list', 'login_required': False}, {'verb': 'table', 'login_required': False}, {'verb': 'search', 'login_required': False}], 'columns': [{'name': 'filename', '_type': 'db.UnicodeText'}, {'name': 'title', '_type': 'db.UnicodeText'}, {'name': 'body', 'type': 'long_text', '_type': 'db.UnicodeText'}, {'name': 'tag', 'type': 'relationship', 'multiple': True, 'secondary': {'name': 'blog_post__tag', 'columns': [{'name': 'blog_post'}, {'name': 'tag'}]}, '_type': 'relationship'}, {'name': 'created_dt', '_type': 'db.UnicodeText'}, {'name': 'updated_dt', '_type': 'db.UnicodeText'}], 'display': {'primary': 'title', 'secondary': 'created_dt'}, '_secondaries': [{'name': 'blog_post__tag', 'columns': [{'name': 'blog_post'}, {'name': 'tag'}]}], '_verbs': {'get': {'per_item': 'True', 'methods': [
|
|
|
|
'GET'], 'is_login_required': False, 'the_roles_required': []}, 'list': {'per_item': 'False', 'methods': ['GET'], 'is_login_required': False, 'the_roles_required': []}, 'table': {'per_item': 'False', 'methods': ['GET'], 'is_login_required': False, 'the_roles_required': []}, 'search': {'per_item': 'False', 'methods': ['GET'], 'is_login_required': False, 'the_roles_required': []}, 'create': {'per_item': 'False', 'methods': ['GET', 'POST'], 'is_login_required': True, 'the_roles_required': ['admin']}, 'update': {'per_item': 'True', 'methods': ['GET', 'POST'], 'is_login_required': True, 'the_roles_required': ['admin']}, 'delete': {'per_item': 'True', 'methods': ['GET', 'POST'], 'is_login_required': True, 'the_roles_required': ['admin']}}, 'acls': {'get': {'authn': False, 'authz': []}, 'list': {'authn': False, 'authz': []}, 'table': {'authn': False, 'authz': []}, 'search': {'authn': False, 'authz': []}, 'create': {'authn': True, 'authz': ['admin']}, 'update': {'authn': True, 'authz': ['admin']}, 'delete': {'authn': True, 'authz': ['admin']}}})
|
2020-07-08 14:36:13 +02:00
|
|
|
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=get_view_context,
|
|
|
|
verb="get",
|
|
|
|
methods=['GET'],
|
|
|
|
per_item=True,
|
|
|
|
is_login_required=False,
|
|
|
|
the_roles_required=[],
|
|
|
|
)
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=list_view_context,
|
|
|
|
verb="list",
|
|
|
|
methods=['GET'],
|
|
|
|
per_item=False,
|
|
|
|
is_login_required=False,
|
|
|
|
the_roles_required=[],
|
|
|
|
)
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=table_view_context,
|
|
|
|
verb="table",
|
|
|
|
methods=['GET'],
|
|
|
|
per_item=False,
|
|
|
|
is_login_required=False,
|
|
|
|
the_roles_required=[],
|
|
|
|
)
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=search_view_context,
|
|
|
|
verb="search",
|
|
|
|
methods=['GET'],
|
|
|
|
per_item=False,
|
|
|
|
is_login_required=False,
|
|
|
|
the_roles_required=[],
|
|
|
|
)
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=create_view_context,
|
|
|
|
verb="create",
|
|
|
|
methods=['GET', 'POST'],
|
|
|
|
per_item=False,
|
|
|
|
is_login_required=True,
|
|
|
|
the_roles_required=['admin'],
|
|
|
|
)
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=update_view_context,
|
|
|
|
verb="update",
|
|
|
|
methods=['GET', 'POST'],
|
|
|
|
per_item=True,
|
|
|
|
is_login_required=True,
|
|
|
|
the_roles_required=['admin'],
|
|
|
|
)
|
|
|
|
|
|
|
|
blog_post.register_verb(view_context=delete_view_context,
|
|
|
|
verb="delete",
|
|
|
|
methods=['GET', 'POST'],
|
|
|
|
per_item=True,
|
|
|
|
is_login_required=True,
|
|
|
|
the_roles_required=['admin'],
|
|
|
|
)
|