Django: Anonymous session & “temporary” one-to-one related model?
问题 Currently, I have a Cart model for each registered CustomUser (OneToOne relation): class Cart(models.Model): created_at = models.DateTimeField(auto_now_add = True) user = models.OneToOneField(CustomUser, related_name='cart') But now I have some requirement for anonymous user (guest). after looking for some articles, session seems to be required? Simple database-based session. How to let guest has a related temporary GuestCart model when they need : Because I don't expect even a robot has a