def admin_video_add(): form = VideoForm() if form.validate_on_submit(): video = Video() form.populate_obj(video) video.put() return redirect(url_for('gallery.admin_video')) return render_template('gallery/admin/video_add.html', form=form)
def admin_video_edit(key_id): video = Video.retrieve_by_id(key_id) if not video: return redirect(url_for('gallery.admin_video')) if request.method == 'POST' and 'delete_video' in request.form: video.key.delete() return redirect(url_for('gallery.admin_video')) form = VideoForm(obj=video) if form.validate_on_submit(): form.populate_obj(video) video.put() return redirect(url_for('gallery.admin_video')) return render_template('gallery/admin/video_edit.html', form=form)