def ui_new_channel(): form = ChannelForm(request.form) if request.method == 'POST' and form.validate(): # Get form data class Args: channel = form.channel.data separator = form.separator.data artist_before_title = form.artist_before_title.data # save the channel Controller.new_channel(Args()) return redirect('/ui/channels') return render_template('channels/new_channel.html', form=form)
def post(): parser = reqparse.RequestParser() parser.add_argument('channel', required=True) parser.add_argument('separator', required=True) parser.add_argument('artist_before_title', required=True) args = parser.parse_args() return { 'message': 'Channel has been added.', 'data': Controller.new_channel(args) }, 201