Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

Commit

Permalink
add exception DoesNotExist
Browse files Browse the repository at this point in the history
  • Loading branch information
Wrede committed Mar 21, 2023
1 parent 8fb8d10 commit e9551cc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion scripts/admin_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@

def run(*args):
admin = User.objects.get(username="admin")
_ = Token.objects.create(user=admin)
try:
_ = Token.objects.get(user=admin)
except Token.DoesNotExist:
_ = Token.objects.create(user=admin)

0 comments on commit e9551cc

Please sign in to comment.