Skip to content

Commit

Permalink
Revert make_token file
Browse files Browse the repository at this point in the history
  • Loading branch information
VadimKovalenkoSNF committed Dec 25, 2024
1 parent d15ae46 commit 7b0acf1
Showing 1 changed file with 8 additions and 16 deletions.
24 changes: 8 additions & 16 deletions src/django/api/management/commands/make_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,13 @@

class Command(BaseCommand):
help = ('Usage: Create an API token for the user during the database '
'reset, and set admin rights.')
'reset.')

def handle(self, *args, **options):
call_command(
'shell',
'-c',
(
"from rest_framework.authtoken.models import Token;"
"from api.models import User;"
"user = User.objects.get(id=2);"
"user.is_staff = True;"
"user.is_superuser = True;"
"user.save();"
"token = Token.objects.create(user=user,"
"key='1d18b962d6f976b0b7e8fcf9fcc39b56cf278051');"
"print(f'Token for {user.email}: {token.key}')"
)
)
call_command('shell',
'-c',
("from rest_framework.authtoken.models import Token; "
"from api.models import User; token = "
"Token.objects.create(user=User.objects.get(id=2),"
"key='1d18b962d6f976b0b7e8fcf9fcc39b56cf278051'); "
"print('Token for [email protected]'); print(token)"))

0 comments on commit 7b0acf1

Please sign in to comment.