def create(): """Create application.""" form = ApplicationForm() if form.validate_on_submit(): OAuthClient.create(user=current_user, name=form.name.data, desc=form.desc.data, website=form.website.data, redirect_uri=form.redirect_uri.data) flash(gettext('You have created an application!'), 'success') return redirect(url_for('.index')) return render_template('profile/applications/create.html', form=form)
def create(): """Create application.""" form = ApplicationForm() if form.validate_on_submit(): OAuthClient.create( user=current_user, name=form.name.data, desc=form.desc.data, website=form.website.data, redirect_uri=form.redirect_uri.data, ) flash(gettext("You have created an application!"), "success") return redirect(url_for(".index")) return render_template("profile/applications/create.html", form=form)
def edit(client_id): application = OAuthClient.query.get_or_404(client_id) if application.user != current_user: raise NotFound() form = ApplicationForm() if form.validate_on_submit(): application.update( name=form.name.data, desc=form.desc.data, website=form.website.data, redirect_uri=form.redirect_uri.data ) flash(gettext("You have updated an application!"), "success") return redirect(url_for(".index")) else: form.name.data = application.name form.desc.data = application.desc form.website.data = application.website form.redirect_uri.data = application.redirect_uri return render_template("profile/applications/edit.html", form=form)
def edit(client_id): application = OAuthClient.query.get_or_404(client_id) if application.user != current_user: raise NotFound() form = ApplicationForm() if form.validate_on_submit(): application.update(name=form.name.data, desc=form.desc.data, website=form.website.data, redirect_uri=form.redirect_uri.data) flash(gettext("You have updated an application!"), 'success') return redirect(url_for('.index')) else: form.name.data = application.name form.desc.data = application.desc form.website.data = application.website form.redirect_uri.data = application.redirect_uri return render_template('profile/applications/edit.html', form=form)