Fullstack Fruit & Veg Shop: A web application developed with HTML, CSS, and JavaScript for the frontend, and Django for the backend. Features include user authentication, a product catalogue, shopping cart functionality, and order management. and much more
Issue Fixed: Resolved an IntegrityError caused by using auto_now for date_ban_was_issued. This broke the tests because the field no longer had default value and was incorrectly set to null.
Original Approach: The initial intent was for the ban to start from the current day using auto_now, but later opted to allow the admin or superuser to manually set the ban date. This change introduced the error during testing.
Solution: Removed auto_now from date_ban_was_issued, now allowing manual entry for any given start date. Tests have been updated accordingly.
Previous Code:
date_ban_was_issued = models.DateTimeField(auto_now=True) # This caused the error
Updated Code:
date_ban_was_issued = models.DateTimeField() # Manually set by admin/superuser
Issue Fixed: Resolved an
IntegrityError
caused by usingauto_now
fordate_ban_was_issued
. This broke the tests because the field no longer had default value and was incorrectly set tonull
.Original Approach: The initial intent was for the ban to start from the current day using
auto_now
, but later opted to allow theadmin
orsuperuser
to manually set the ban date. This change introduced the error during testing.Solution: Removed
auto_now
fromdate_ban_was_issued
, now allowing manual entry for any given start date. Tests have been updated accordingly.Previous Code:
Updated Code: