[Django]-Django handle Annonymous users

0👍

It seems the first way is good than second, don’t worry about DB population

Basically if you want to save the anonymous user, you has been decided to remove Sign Up section of you’re site and still has saved Users, So you must have to act like fixed user and generate a random Username or NickName for it without password

I propose you to use this simple way and if you wanna to speed up you’re DB you can use Redis

0👍

For your particular example, do not worry about the number of users in your database, but give each person (anonymous or not) their own User record.

If you do want to go with 1 record, the package django-guardian creates an anonymous user (because it needs an actual database User row for its configuration), you can read more about it here: https://django-guardian.readthedocs.io/en/stable/configuration.html

Note that Django has something like an anonymous User, a User-like object with is_authenticated=False. Sometimes when working with Anonymous Users this gets confusing.

👤dyve

Leave a comment