def playground_project(username, coprname): copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first() if not copr: flask.flash("Project {0} does not exist".format(copr)) return flask.render_template("admin/playground.html") form = forms.AdminPlaygroundForm() form.playground.data = copr.playground return flask.render_template("admin/playground.html", form_set=form, copr=copr)
def playground_set(username, coprname): copr = coprs_logic.CoprsLogic.get(flask.g.user, username, coprname).first() if copr: form = forms.AdminPlaygroundForm() if form.validate_on_submit(): try: copr.playground = form.playground.data coprs_logic.CoprsLogic.set_playground(flask.g.user, copr) except InsufficientRightsException as e: flask.flash(str(e)) db.session.rollback() else: flask.flash("Playground flag has been updated") db.session.commit() return flask.redirect( flask.url_for("admin_ns.playground_project", username=username, coprname=coprname))