From cdf160dfc3d220ec879fd7a4fa648144a96cc987 Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Sat, 11 Aug 2012 11:09:20 +0200 Subject: [PATCH] fix some problems with the creation of new users --- openslides/participant/forms.py | 4 ++-- openslides/participant/views.py | 3 ++- openslides/utils/views.py | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/openslides/participant/forms.py b/openslides/participant/forms.py index f37a28420..a6245e94c 100644 --- a/openslides/participant/forms.py +++ b/openslides/participant/forms.py @@ -24,8 +24,8 @@ class UserCreateForm(forms.ModelForm, CssClassMixin): first_name = forms.CharField(label=_("First name")) last_name = forms.CharField(label=_("Last name")) groups = forms.ModelMultipleChoiceField( - queryset=OpenSlidesGroup.objects.all(), label=_("User groups"), - required=False) + queryset=OpenSlidesGroup.objects.exclude(name__iexact='anonymous'), + label=_("User groups"), required=False) is_active = forms.BooleanField( label=_("Active"), required=False, initial=True) diff --git a/openslides/participant/views.py b/openslides/participant/views.py index 4ee452681..67684ba58 100644 --- a/openslides/participant/views.py +++ b/openslides/participant/views.py @@ -28,6 +28,7 @@ from reportlab.platypus import ( from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth.forms import PasswordChangeForm +from django.contrib.auth.models import User from django.contrib.auth.views import login as django_login from django.core.urlresolvers import reverse from django.shortcuts import redirect @@ -143,7 +144,7 @@ class UserCreateView(CreateView): context_object_name = 'edit_user' form_class = UserCreateForm success_url = 'user_overview' - apply_url = 'participant_edit' + apply_url = 'user_edit' def manipulate_object(self, form): self.object.username = gen_username(form.cleaned_data['first_name'], diff --git a/openslides/utils/views.py b/openslides/utils/views.py index 45a2b0e9d..becdbfc8b 100644 --- a/openslides/utils/views.py +++ b/openslides/utils/views.py @@ -256,6 +256,7 @@ class CreateView(PermissionMixin, _CreateView): self.object = form.save(commit=False) self.manipulate_object(form) self.object.save() + form.save_m2m() return HttpResponseRedirect(self.get_success_url()) def get_success_message(self):