OpenSlides/openslides/users/management/commands/createsuperuser.py
Norman Jäckel 3a19218bd5 Refactored parts of users app.
Refactored user creation and update via REST API. Used new serializer.
Cleaned up management commands, signals and imports. Moved code from 'api.py' to 'models.py'.
Changed usage of group 'Registered'. Now the users don't have to be members to gain its permissions. Used customized auth backend for this.
Added and changed some tests.
2015-02-14 02:29:53 +01:00

16 lines
455 B
Python

from django.core.management.base import NoArgsCommand
from openslides.users.models import User
class Command(NoArgsCommand):
"""
Command to create or reset the admin user.
"""
def handle_noargs(self, **options):
created = User.objects.create_or_reset_admin_user()
if created:
self.stdout.write('Admin user successfully created.')
else:
self.stdout.write('Admin user successfully reset.')