Verified Commit b693ee32 authored by Sli's avatar Sli

Group: add a label on users to delete

parent 08d03087
......@@ -12,6 +12,7 @@
{% else %}
<form action="{{ url('core:group_detail', object.id) }}" method="post" id="add_users">
{% csrf_token %}
<label for="{{ form.users_removed.id_for_label }}">{{ form.users_removed.label }} :</label>
{{ form.users_removed.errors }}
{% for user in form.users_removed %}
<label for="{{ user.id_for_label }}">
......
......@@ -52,7 +52,7 @@ class EditMembersForm(forms.Form):
super(EditMembersForm, self).__init__(*args, **kwargs)
self.fields["users_removed"] = forms.ModelMultipleChoiceField(
User.objects.filter(id__in=self.current_users).all(),
label=None,
label=_("Users to delete"),
required=False,
widget=forms.CheckboxSelectMultiple,
)
......@@ -65,6 +65,9 @@ class EditMembersForm(forms.Form):
)
def clean_users_added(self):
"""
Check that the user is not trying to add an user already in the group
"""
cleaned_data = super(EditMembersForm, self).clean()
users_added = cleaned_data.get("users_added", None)
if not users_added:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment