79733218

Date: 2025-08-12 13:03:40
Score: 0.5
Natty:
Report link

This feels a lot like a problem sessions are going to solve for you. The main problem here is you are trying to save some information against the AnonymousUser which is a common object for all users that are not authenticated. The way I would approach this is to use database backed sessions saving the information (cart contents) there and then retrieving this and saving against the User/Customer model.

https://docs.djangoproject.com/en/5.2/topics/http/sessions/

As an aside what's the difference between a User and a Customer? It could be argued they are the same thing except a customer has a sales history (which could be a seperate Sale model)

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Contains question mark (0.5):
  • Low reputation (1):
Posted by: simalpas