BrickTracker/bricktracker/views/add.py

39 lines
1.0 KiB
Python
Raw Permalink Normal View History

2025-01-17 11:03:00 +01:00
from flask import Blueprint, current_app, render_template
from flask_login import login_required
from ..configuration_list import BrickConfigurationList
from .exceptions import exception_handler
from ..socket import MESSAGES
add_page = Blueprint('add', __name__, url_prefix='/add')
# Add a set
@add_page.route('/', methods=['GET'])
@login_required
@exception_handler(__file__)
def add() -> str:
BrickConfigurationList.error_unless_is_set('REBRICKABLE_API_KEY')
return render_template(
'add.html',
path=current_app.config['SOCKET_PATH'].value,
namespace=current_app.config['SOCKET_NAMESPACE'].value,
messages=MESSAGES
)
# Bulk add sets
@add_page.route('/bulk', methods=['GET'])
@login_required
@exception_handler(__file__)
def bulk() -> str:
BrickConfigurationList.error_unless_is_set('REBRICKABLE_API_KEY')
return render_template(
'bulk.html',
path=current_app.config['SOCKET_PATH'].value,
namespace=current_app.config['SOCKET_NAMESPACE'].value,
messages=MESSAGES
)