Marking users as new created using server authentication in Django

I have an authentication server based on an outdated database. When someone registers in this database and there is no corresponding record User, I create it. I am wondering if there is a way to warn the Django system about this fact, so that, for example, I can redirect a completely new user to another page.

The only thing I can think of is to add a flag to the user profile entry, named as is_new, which is tested once, and then set to Falseas soon as they are redirected.

Basically, I wonder if someone else understood, so I don't need to reinvent the wheel.

+3
source share
3 answers

I found that the easiest way to achieve this is to do as you said. I had a similar requirement for one of my projects. We needed to show the message "Remember to update your profile" to any new member until they visited their profile for the first time. The client quickly wanted, so we added the "visited_profile" field to the user profile and the default value was set to "False".

, , , ( ). 10 , , if .

+1

, , , :

1) get_or_create (obj, created), created , , ,

2) post_save created, , , .

var, .

, get_or_create, post_save.

+1
-1
source

All Articles