Merge pull request #958 from ae-utbm/fix-group-form

fix user groups form
This commit is contained in:
thomas girod 2024-12-20 11:07:13 +01:00 committed by GitHub
commit baebc0b690
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 5 deletions

View File

@ -285,13 +285,14 @@ class UserProfileForm(forms.ModelForm):
self._post_clean() self._post_clean()
class UserRealGroupForm(forms.ModelForm): class UserGroupsForm(forms.ModelForm):
error_css_class = "error" error_css_class = "error"
required_css_class = "required" required_css_class = "required"
groups = forms.ModelChoiceField( groups = forms.ModelMultipleChoiceField(
RealGroup.objects.all(), queryset=RealGroup.objects.all(),
widget=CheckboxSelectMultiple, widget=CheckboxSelectMultiple,
label=_("Groups"),
) )
class Meta: class Meta:

View File

@ -67,8 +67,8 @@ from core.views.forms import (
LoginForm, LoginForm,
RegisteringForm, RegisteringForm,
UserGodfathersForm, UserGodfathersForm,
UserGroupsForm,
UserProfileForm, UserProfileForm,
UserRealGroupForm,
) )
from counter.models import Refilling, Selling from counter.models import Refilling, Selling
from counter.views.student_card import StudentCardFormView from counter.views.student_card import StudentCardFormView
@ -583,7 +583,7 @@ class UserUpdateGroupView(UserTabsMixin, CanEditPropMixin, UpdateView):
model = User model = User
pk_url_kwarg = "user_id" pk_url_kwarg = "user_id"
template_name = "core/user_group.jinja" template_name = "core/user_group.jinja"
form_class = UserRealGroupForm form_class = UserGroupsForm
context_object_name = "profile" context_object_name = "profile"
current_tab = "groups" current_tab = "groups"