Select Git revision
-
Seon82 authored
* Password reset feature (#8) * Add Django Rest auth module * Try to make the send reset password email work * Modified template mail for reset * Add Django Rest auth module * Try to make the send reset password email work * Modified template mail for reset * test * Ajouté API student * API GET sans authentification * Added POST support * POST API fix * Fixed charfields length in wiki * loosen security * simplify API serialized data * Implemented partial_update * Added special teaching and nationality to serializer * dependantsNumber to int * Fixed factory imports * Added write auth and minor serializer fix * Added read permissions * Read permissions that work? * Actually added read permissions? * Updated tests to pass travis * Updated tests * Fixed all factory tests * Adapté les tests à la nouvelle structure de Student * Created StaffUserFactory and finished fixing tests * Update README.md * Added classType * Fixed migrations * Added last modified year & filters in admin interface Co-authored-by:
chiahetcho <44137047+chiahetcho@users.noreply.github.com> Co-authored-by:
florimondmanca <florimond.manca@gmail.com> Co-authored-by:
Dylan Sechet <dylan.sechet@student-cs.fr> Co-authored-by:
Arthur Guédon <arthur.guedon@student-cs.fr>
Seon82 authored* Password reset feature (#8) * Add Django Rest auth module * Try to make the send reset password email work * Modified template mail for reset * Add Django Rest auth module * Try to make the send reset password email work * Modified template mail for reset * test * Ajouté API student * API GET sans authentification * Added POST support * POST API fix * Fixed charfields length in wiki * loosen security * simplify API serialized data * Implemented partial_update * Added special teaching and nationality to serializer * dependantsNumber to int * Fixed factory imports * Added write auth and minor serializer fix * Added read permissions * Read permissions that work? * Actually added read permissions? * Updated tests to pass travis * Updated tests * Fixed all factory tests * Adapté les tests à la nouvelle structure de Student * Created StaffUserFactory and finished fixing tests * Update README.md * Added classType * Fixed migrations * Added last modified year & filters in admin interface Co-authored-by:
chiahetcho <44137047+chiahetcho@users.noreply.github.com> Co-authored-by:
florimondmanca <florimond.manca@gmail.com> Co-authored-by:
Dylan Sechet <dylan.sechet@student-cs.fr> Co-authored-by:
Arthur Guédon <arthur.guedon@student-cs.fr>
server.py 804 B
"""
Server module for the web calculator.
"""
from fastapi import FastAPI
from fastapi.requests import Request
from fastapi.templating import Jinja2Templates
from calculator.calculator import Calculator
app = FastAPI()
templates = Jinja2Templates(directory="templates")
calc = Calculator()
@app.get("/")
async def root(request: Request):
"""
Default and only route of the web calculator.
Expects either no query parameters or a single query parameter named "expression".
"""
expression = request.query_params.get("expression", "")
context = {"request": request}
if expression:
result = calc(expression)
context = {"request": request,
"expression": expression, "result": result}
return templates.TemplateResponse("index.html", context)