mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 14:13:21 +00:00
Group: add a label on users to delete
This commit is contained in:
parent
08d03087a4
commit
b693ee32f2
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user