def titlepage_save(): user_email = get_current_user_email_with_default() resource_id = request.form['resource_id'] permission = Screenplay.get_users_permission(resource_id, user_email) if permission != 'owner': return redirect(url_for('scriptlist')) obj = TitlePageData.get_or_create(resource_id) fields = [ 'title', 'written_by', 'contact' ] for field in fields: if field in request.form: setattr(obj, field, request.form[field][:64*12]) db.session.commit() return Response('1', mimetype='text/plain')
def titlepage(): resource_id = request.args.get('resource_id') if not current_user.is_authenticated() and resource_id != 'Demo': return redirect(url_for('welcome')) user_email = get_current_user_email_with_default() permission = Screenplay.get_users_permission(resource_id, user_email) if permission != 'owner' and resource_id != 'Demo': return redirect(url_for('scriptlist')) fields = TitlePageData.get_fields_by_resource_id(resource_id) screenplay_title = Screenplay.get_title(resource_id) return render_template('titlepage.html', user=user_email, screenplay_title=screenplay_title, **fields)