♻️(models) refactor user email fields
The email field on the user is renamed to "admin_email" for clarity. The "email" and "name" fields of user's main identity are made available on the user model so it is easier to access it.
This commit is contained in:
committed by
Marie
parent
6d807113bc
commit
7ea6342a01
@@ -202,7 +202,7 @@ class UserViewSet(
|
||||
Prefetch(
|
||||
"identities",
|
||||
queryset=models.Identity.objects.filter(is_main=True),
|
||||
to_attr="main_identity",
|
||||
to_attr="_identities_main",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -245,9 +245,6 @@ class UserViewSet(
|
||||
Return information on currently logged user
|
||||
"""
|
||||
user = request.user
|
||||
user.main_identity = models.Identity.objects.filter(
|
||||
user=user, is_main=True
|
||||
).first()
|
||||
return response.Response(
|
||||
self.serializer_class(user, context={"request": request}).data
|
||||
)
|
||||
@@ -378,7 +375,7 @@ class TeamAccessViewSet(
|
||||
Prefetch(
|
||||
"user__identities",
|
||||
queryset=models.Identity.objects.filter(is_main=True),
|
||||
to_attr="main_identity",
|
||||
to_attr="_identities_main",
|
||||
)
|
||||
)
|
||||
# Abilities are computed based on logged-in user's role and
|
||||
|
||||
Reference in New Issue
Block a user