diff --git a/core/views/forms.py b/core/views/forms.py index 88963789..8a998ab0 100644 --- a/core/views/forms.py +++ b/core/views/forms.py @@ -285,13 +285,14 @@ class UserProfileForm(forms.ModelForm): self._post_clean() -class UserRealGroupForm(forms.ModelForm): +class UserGroupsForm(forms.ModelForm): error_css_class = "error" required_css_class = "required" - groups = forms.ModelChoiceField( - RealGroup.objects.all(), + groups = forms.ModelMultipleChoiceField( + queryset=RealGroup.objects.all(), widget=CheckboxSelectMultiple, + label=_("Groups"), ) class Meta: diff --git a/core/views/user.py b/core/views/user.py index 7b6c146b..264a8dd6 100644 --- a/core/views/user.py +++ b/core/views/user.py @@ -67,8 +67,8 @@ from core.views.forms import ( LoginForm, RegisteringForm, UserGodfathersForm, + UserGroupsForm, UserProfileForm, - UserRealGroupForm, ) from counter.models import Refilling, Selling from counter.views.student_card import StudentCardFormView @@ -583,7 +583,7 @@ class UserUpdateGroupView(UserTabsMixin, CanEditPropMixin, UpdateView): model = User pk_url_kwarg = "user_id" template_name = "core/user_group.jinja" - form_class = UserRealGroupForm + form_class = UserGroupsForm context_object_name = "profile" current_tab = "groups"