Skip to content

Commit d7dbc75

Browse files
authored
feat(hc): Add __str__ implementation for RpcUser (#58485)
This matches the implementation in [`django.contrib.auth.base_user.AbstractBaseUser`](https://github.com/django/django/blob/main/django/contrib/auth/base_user.py#L54-L55). Project transfer emails specifically rely upon this behavior, but there are likely other usages: - https://github.com/getsentry/sentry/blob/master/src/sentry/api/endpoints/project_transfer.py#L88 - https://github.com/getsentry/sentry/blob/master/src/sentry/templates/sentry/emails/transfer_project.txt#L5 Fixes HC-919
1 parent 80e576d commit d7dbc75

File tree

1 file changed

+3
-0
lines changed
  • src/sentry/services/hybrid_cloud/user

1 file changed

+3
-0
lines changed

src/sentry/services/hybrid_cloud/user/model.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ def __hash__(self) -> int:
6868
# TODO: Remove the need for this
6969
return hash((self.id, self.pk))
7070

71+
def __str__(self): # API compatibility with ORM User
72+
return self.get_username()
73+
7174
def by_email(self, email: str) -> "RpcUser":
7275
if email == self.email:
7376
return self

0 commit comments

Comments
 (0)