mirror of
https://github.com/suitenumerique/docs.git
synced 2026-09-30 05:25:06 +02:00
✨(backend) add a is_first_connection flag to the User model
Backend part of #1796. This changes allows to display an onboarding modal the first time that the get_me() API view is called. I originally tried to check if `User.last_login` was `None`, but it is updated as soon as the user is logged, so I chose to create a flag on the model.
This commit is contained in:
@@ -32,8 +32,21 @@ class UserSerializer(serializers.ModelSerializer):
|
||||
|
||||
class Meta:
|
||||
model = models.User
|
||||
fields = ["id", "email", "full_name", "short_name", "language"]
|
||||
read_only_fields = ["id", "email", "full_name", "short_name"]
|
||||
fields = [
|
||||
"id",
|
||||
"email",
|
||||
"full_name",
|
||||
"short_name",
|
||||
"language",
|
||||
"is_first_connection",
|
||||
]
|
||||
read_only_fields = [
|
||||
"id",
|
||||
"email",
|
||||
"full_name",
|
||||
"short_name",
|
||||
"is_first_connection",
|
||||
]
|
||||
|
||||
def get_full_name(self, instance):
|
||||
"""Return the full name of the user."""
|
||||
|
||||
Reference in New Issue
Block a user