S
S
Sergey Nizhny Novgorod2017-03-22 16:33:01
Django
Sergey Nizhny Novgorod, 2017-03-22 16:33:01

How to give names to anonymous users in Django?

Hello.
Task: Both authorized people and anonymous people should have the right to write to the chat.
The chat message model looks something like this (chat channel, post author, text itself):

threed= models.CharField()
author = models.ForeignKey(User)
chattext = models.TextField()

With authorized users, everything is clear, but what to do with those who do not have it? How to distinguish them in the chat and give the author for posts?
Generate a new random account for each anonymous and force it to authorize?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
devalone, 2017-03-22
@Terras

AnonymousUser seems to be very limited, I think it's better to generate a new user for everyone, or create one guest with limited rights and log everyone under this account.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question