From 161ce5a509569527d2e275fa4ad403fc4058b3d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20B=C3=B6hlke?= Date: Mon, 7 Nov 2016 07:27:58 +0100 Subject: [PATCH 1/3] cleanup build dependencies (wget, pip and apt package cache) --- Dockerfile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Dockerfile b/Dockerfile index b13593148..adf555f73 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,6 +20,10 @@ ADD requirements_production.txt /app/requirements_production.txt RUN pip install -r /app/requirements_production.txt 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 ADD . /app From 01e27c571373acf4508e0be3806263d938c9378c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20B=C3=B6hlke?= Date: Tue, 8 Nov 2016 10:14:26 +0100 Subject: [PATCH 2/3] add command for creating an openslides user --- .../commands/createopenslidesuser.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 openslides/users/management/commands/createopenslidesuser.py diff --git a/openslides/users/management/commands/createopenslidesuser.py b/openslides/users/management/commands/createopenslidesuser.py new file mode 100644 index 000000000..63f34f4c5 --- /dev/null +++ b/openslides/users/management/commands/createopenslidesuser.py @@ -0,0 +1,35 @@ +from django.core.management.base import BaseCommand + +from openslides.users.models import UserManager + + +class Command(BaseCommand): + """ + Command to create a new 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'], + } + UserManager.create_user(options['username'], options['password'], **user_data) From 9a51bbe663a505c8ac4e2964af0de7b334e6b7d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 10 Nov 2016 11:11:27 +0100 Subject: [PATCH 3/3] Update createopenslidesuser.py --- .../users/management/commands/createopenslidesuser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openslides/users/management/commands/createopenslidesuser.py b/openslides/users/management/commands/createopenslidesuser.py index 63f34f4c5..095c7b7cc 100644 --- a/openslides/users/management/commands/createopenslidesuser.py +++ b/openslides/users/management/commands/createopenslidesuser.py @@ -1,11 +1,11 @@ from django.core.management.base import BaseCommand -from openslides.users.models import UserManager +from ...models import User class Command(BaseCommand): """ - Command to create a new OpenSlides user + Command to create an OpenSlides user. """ help = 'Creates an OpenSlides user.' @@ -32,4 +32,4 @@ class Command(BaseCommand): 'first_name': options['first_name'], 'last_name': options['last_name'], } - UserManager.create_user(options['username'], options['password'], **user_data) + User.objects.create_user(options['username'], options['password'], **user_data)