Skip to content

Commit

Permalink
Merge pull request #958 from ae-utbm/fix-group-form
Browse files Browse the repository at this point in the history
fix user groups form
  • Loading branch information
imperosol authored Dec 20, 2024
2 parents 38ceaf3 + 9f3a10c commit baebc0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
7 changes: 4 additions & 3 deletions core/views/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,14 @@ def process(self, files):
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:
Expand Down
4 changes: 2 additions & 2 deletions core/views/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@
LoginForm,
RegisteringForm,
UserGodfathersForm,
UserGroupsForm,
UserProfileForm,
UserRealGroupForm,
)
from counter.models import Refilling, Selling
from counter.views.student_card import StudentCardFormView
Expand Down Expand Up @@ -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"

Expand Down

0 comments on commit baebc0b

Please sign in to comment.