Skip to content

Commit

Permalink
Add user.get_token() helper
Browse files Browse the repository at this point in the history
  • Loading branch information
nik committed Nov 4, 2024
1 parent 04ac6fe commit 56e1493
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions label_studio/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ def get_full_name(self):
def get_short_name(self):
"""Return the short name for the user."""
return self.first_name

def get_token(self) -> Token:
return Token.objects.filter(user=self).first()

def reset_token(self) -> Token:
Token.objects.filter(user=self).delete()
Expand Down

0 comments on commit 56e1493

Please sign in to comment.