Datetime module of python does its job correctly but the real issue is of database....Its either problem of squlite3 or cs50's php.....but the value stored in table is "just the date" even if value provided is "both datetime".....I even tried by changing type of "datetime" field to "text" but the problem isn't solved.
While it is arguably better UI/UX to validate the input in the html, it does not fulfill the requirements of the buy spec:
Require that a user input a number of shares, implemented as a text field whose name is shares. Render an apology if the input is not a positive integer.
Since the quote spec calls for an element named "symbol", and this if not request.form.get("stock"): is apparently working, it looks like the element is not named properly in the html.
FYI to change "I think" to "I know".
ls -al helpers.py
(in the finance directory) should return
-rw------- 1 ubuntu ubuntu 1748 Apr ...
elif symbol not in rows: will always return True becauserows is a list of dictionaries, and symbol is a string. You could iterate through rows and check the value of each row['symbol'] against symbol.
Think about how the function would work if this:
rows = ("SELECT * FROM portfolio WHERE user_id = ?", session["user_id"])