Description of PR that completes issue here...
When a new user registered themselves and navigated to the cart page, a 404 was being thrown because there was no order matching the user id. furthermore, there was a 500 being thrown due to the database expecting a date.today() instead of a datetime.now() when setting the date for a new order.
Changes
Imported date from datetime in django
removed unused 'as ex' variable
replaced created_date value on new order with date.today()
in list function of cart view, replaced content of exception statement that threw '404 not found' with functionality to add a new order, then moved subsequent serialization logic below that try/except block
removed product list serializer and statement that added product list as property on the new order object, as it was unused
Requests / Responses
If this PR contains code that defines a new request/response, or changes an existing one, please put the JSON representations here.
Description of PR that completes issue here... When a new user registered themselves and navigated to the cart page, a 404 was being thrown because there was no order matching the user id. furthermore, there was a 500 being thrown due to the database expecting a date.today() instead of a datetime.now() when setting the date for a new order.
Changes
Requests / Responses
If this PR contains code that defines a new request/response, or changes an existing one, please put the JSON representations here.
Request
GET
/cart
gets current users cartResponse
HTTP/1.1 200 OK
Testing
Related Issues