Merge pull request #2601 from boehlke/master
Add new command for adding users.
This commit is contained in:
commit
31f29bdfc9
@ -20,6 +20,10 @@ ADD requirements_production.txt /app/requirements_production.txt
|
|||||||
RUN pip install -r /app/requirements_production.txt
|
RUN pip install -r /app/requirements_production.txt
|
||||||
RUN pip install daphne psycopg2 asgi_redis
|
RUN pip install daphne psycopg2 asgi_redis
|
||||||
|
|
||||||
|
## Clean up
|
||||||
|
RUN apt-get remove -y python3-pip wget
|
||||||
|
RUN rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# BUILD APP
|
# BUILD APP
|
||||||
ADD . /app
|
ADD . /app
|
||||||
|
|
||||||
|
35
openslides/users/management/commands/createopenslidesuser.py
Normal file
35
openslides/users/management/commands/createopenslidesuser.py
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
from django.core.management.base import BaseCommand
|
||||||
|
|
||||||
|
from ...models import User
|
||||||
|
|
||||||
|
|
||||||
|
class Command(BaseCommand):
|
||||||
|
"""
|
||||||
|
Command to create an OpenSlides user.
|
||||||
|
"""
|
||||||
|
help = 'Creates an OpenSlides user.'
|
||||||
|
|
||||||
|
def add_arguments(self, parser):
|
||||||
|
parser.add_argument(
|
||||||
|
'first_name',
|
||||||
|
help='The first name of the new user.'
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'last_name',
|
||||||
|
help='The last name of the new user.'
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'username',
|
||||||
|
help='The username of the new user.'
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'password',
|
||||||
|
help='The password of the new user.'
|
||||||
|
)
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
user_data = {
|
||||||
|
'first_name': options['first_name'],
|
||||||
|
'last_name': options['last_name'],
|
||||||
|
}
|
||||||
|
User.objects.create_user(options['username'], options['password'], **user_data)
|
Loading…
Reference in New Issue
Block a user