OpenSlides/openslides/users/management/commands/createsuperuser.py

18 lines
485 B
Python
Raw Normal View History

from django.core.management.base import BaseCommand
2015-01-16 14:18:34 +01:00
2015-09-16 00:55:27 +02:00
from ...models import User
2015-01-16 14:18:34 +01:00
class Command(BaseCommand):
2015-01-16 14:18:34 +01:00
"""
Command to create or reset the admin user.
2015-01-16 14:18:34 +01:00
"""
help = 'Creates or resets the admin user.'
def handle(self, *args, **options):
created = User.objects.create_or_reset_admin_user()
if created:
2015-01-16 14:18:34 +01:00
self.stdout.write('Admin user successfully created.')
else:
self.stdout.write('Admin user successfully reset.')