🧑💻(models) improve user str representation
Improve user model str representation to display name or email if provided. Otherwise, returns sub as last resort.
This commit is contained in:
committed by
Marie
parent
2598f3649a
commit
66300aca66
@@ -230,11 +230,7 @@ class User(AbstractBaseUser, BaseModel, auth_models.PermissionsMixin):
|
||||
verbose_name_plural = _("users")
|
||||
|
||||
def __str__(self):
|
||||
return (
|
||||
str(self.profile_contact)
|
||||
if self.profile_contact
|
||||
else self.email or str(self.sub)
|
||||
)
|
||||
return self.name if self.name else self.email or f"User {self.sub}"
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user