def ui_delete_channel(identifier): # Get channel info channel = Controller.get_channel(identifier) form = ChannelForm(formdata=request.form) if channel: if request.method == 'POST': # Delete channel Controller.delete_channel(identifier) return redirect('/ui/channels') return render_template('channels/delete_channel.html', channel=channel['channel'], separator=channel['separator'], artist_before_title=channel['artist_before_title'])
def ui_edit_channel(identifier): # Get channel info channel = Controller.get_channel(identifier) form = ChannelForm(formdata=request.form, separator=channel['separator'], artist_before_title=channel['artist_before_title']) if channel: if request.method == 'POST' and form.validate(): # save edits class Args: separator = form.separator.data artist_before_title = form.artist_before_title.data Controller.update_channel(identifier, Args()) return redirect('/ui/channels') return render_template('channels/edit_channel.html', form=form, channel=channel['channel'])
def get(identifier): return { 'message': 'Success', 'data': Controller.get_channel(identifier) }, 200