Skip to content
Myr

views.py

This file

Path

examples/javascript/js_example/views.py

18 lines · 429 bytes · Python

Last changed by

use ruff linter and formatter (#5331)David Lordbefore adoption9a12f34

History of this file

Take it

The walk stopped after 200 commits: lines older than 604de4b point at it.

Merge branch '2.2.x'David Lordbefore adoption604de4b

lines 1–4why, one step back
1from flask import jsonify
2from flask import render_template3from flask import request4

use ruff linter and formatter (#5331)David Lordbefore adoption9a12f34

line 5why, one step back
5from . import app

Merge branch '2.2.x'David Lordbefore adoption604de4b

lines 6–18why, one step back
6
78@app.route("/", defaults={"js": "fetch"})9@app.route("/<any(xhr, jquery, fetch):js>")10def index(js):11 return render_template(f"{js}.html", js=js)121314@app.route("/add", methods=["POST"])15def add():16 a = request.form.get("a", 0, type=float)17 b = request.form.get("b", 0, type=float)18 return jsonify(result=a + b)