3a19218bd5
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.
16 lines
455 B
Python
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.')
|