MCS 275 Spring 2023
Emily Dumas
Reminders and announcements:
python3 -m pip install Flask
in preparation for using it in upcoming assignments.
Build the worker view template
Create the database and link it to the Flask application
Single table orders
with columns:
woid
- integer uniquely identifying a WOdescription
- stringassigned_user
- either
created_ts
- "created timestamp" as
time.time()
assigned_ts
- "assigned timestamp", either:
time.time() when assigned
completed_ts
- "completed timestamp"
time.time() when completed
A row only makes sense if created_ts
is not NULL, and if assigned_ts
and
assigned_user
are either both NULL or both non-NULL.
Route /worker/ddumas/
results in:
ddumas
assigned WOsNote part of the URL is an argument. The pattern is /worker/<username>/
Buttons on the worker view form need to perform actions.
We'll make Flask routes for this, e.g. /wo/58/assign_to/ddumas/
.
Requesting that URL should perform an action. But what content will it serve?
Every HTTP request results in a numerical status.
So far, we've seen 404 (NOT FOUND) and 200 (OK, generated by Flask when we return HTML).
There are also codes that instruct the browser to load another resource, e.g. 302 (FOUND).
Return flask.redirect("destination")
to make this happen.