Esempio n. 1
0
from flask_ import Blueprint
from flask_restful import Api
from .endpoints import BaseUserView, DetailUserView, LoginUserView, LogoutUserView

user = Blueprint('user', __name__)
api = Api(user)

api.add_resource(BaseUserView, '/')  # create - list
api.add_resource(LoginUserView, '/logout/')  #
api.add_resource(LogoutUserView, '/logout/')  #
api.add_resource(DetailUserView, '/<id>/')  #  retrieve
Esempio n. 2
0
from flask_ import Blueprint

from .views import MainPageView, DetailProductView

core = Blueprint('core', __name__, template_folder='templates')

core.add_url_rule(rule='/',
                  view_func=MainPageView.as_view(
                      'mainpage', template_name='core/mainpage.html'))

core.add_url_rule(rule='/detail/<name>/',
                  view_func=DetailProductView.as_view(
                      'detail_main',
                      template_name='core/detail.html',
                      key='name',
                      from_params=False))

core.add_url_rule(rule='/api/products/',
                  view_func=MainPageView.as_view(
                      'products', template_name='core/objects/products.html'))

core.add_url_rule(rule='/api/detail-product/',
                  view_func=DetailProductView.as_view(
                      'detail',
                      template_name='core/objects/detail_modal.html',
                      key='id'))
Esempio n. 3
0
from flask_ import Blueprint
from flask_restful import Api
from .endpoints import CommentView, CommentViewList

comment = Blueprint('comment', __name__)
api = Api(comment)

api.add_resource(CommentViewList, '/')  # list - Get
api.add_resource(CommentView, '/<id>/')  #
Esempio n. 4
0
from flask_ import Blueprint

my_admin = Blueprint('my_admin', __name__, template_folder='templates')
Esempio n. 5
0
from flask_ import Blueprint
from .views import CartView

cart = Blueprint('cart', __name__, template_folder='templates')

cart.add_url_rule('/put/', view_func=CartView.as_view('put', event='add'))
cart.add_url_rule('/delete/', view_func=CartView.as_view('delete', event='delete'))

cart.add_url_rule('/delete-all/', view_func=CartView.as_view('delete-all', event='delete_all'))
cart.add_url_rule('/check/', view_func=CartView.as_view('check', template_name='cart/objects/cart_object.html'))

from .template_func import cart_count
Esempio n. 6
0
from flask_ import Blueprint
from .views import StripePay, SuccessView

payment = Blueprint('payment', __name__, template_folder='templates')

payment.add_url_rule('/payment/charge/',
                     view_func=StripePay.as_view('pay-stripe'))

payment.add_url_rule('/payment/done/',
                     view_func=SuccessView.as_view(
                         'success-pay', template_name='payment/success.html'))
Esempio n. 7
0
from flask_ import Blueprint
from flask_restful import Api
from .endpoints import QuestionView, QuestionViewList


question = Blueprint('question', __name__)
api = Api(question)


api.add_resource(QuestionViewList, '/') # list - Get
api.add_resource(QuestionView, '/<id>/') #
Esempio n. 8
0
from flask_ import Blueprint
from .views import OrderView, OrderPay

order = Blueprint('order', __name__, template_folder='templates')

order.add_url_rule('/order/',
                   view_func=OrderView.as_view(
                       'order-form', template_name='order/order_form.html'))
order.add_url_rule('/order/payment/',
                   view_func=OrderPay.as_view(
                       'order-pay', template_name='order/order_payment.html'))