def repo_dates_plots(): extra = {} update_extra(extra) if request.method == "POST": year = int(request.form["year"]) extra["year"] = year extra["repo_count"] = neyronka.predict(year) return render_template('repos_date_plots.html', **extra)
def get(model): instance = get_model_from_key(model).query.first() form_cls = get_form_from_key(model) form = form_cls(**{"obj": instance} if instance else {}) is_exist = bool(instance) extra = { "form": form, "submit_value": "Update" if is_exist else "Create", "is_exist": is_exist, "model_name": instance.__class__.__name__.lower() if instance else model, } update_extra(extra) return render_template('index.html', **extra)
def update_soft(): soft = db.session.query(Soft).first() extra = {} update_extra(extra) if request.method == "GET": form = SoftForm(obj=soft) extra["form"] = form return render_template('update_soft.html', **extra) else: form = SoftForm(request.form, obj=soft) if form.validate(): form.populate_obj(soft) db.session.add(soft) db.session.commit() else: return jsonify({"Error": "Invalid cost or version"}) return redirect(url_for('update_soft'))
def main(): extra = {} update_extra(extra) return render_template('index.html', **extra)
def soft_plot(): extra = {} update_extra(extra) return render_template('soft_plot.html', **extra)
def soft_data(): soft = db.session.query(Soft).all() extra = {"soft": soft} update_extra(extra) return render_template('soft.html', **extra)