diff --git a/users/forms.py b/users/forms.py index 33504c99..b9401846 100644 --- a/users/forms.py +++ b/users/forms.py @@ -258,7 +258,7 @@ class NewListRightForm(ListRightForm): self.fields['gid'].label = 'Gid, attention, cet attribut ne doit pas être modifié après création' class DelListRightForm(ModelForm): - listrights = forms.ModelMultipleChoiceField(queryset=ListRight.objects.all().select_related('user'), label="Droits actuels", widget=forms.CheckboxSelectMultiple) + listrights = forms.ModelMultipleChoiceField(queryset=ListRight.objects.all().select_related('user'), label="Droits actuels", widget=forms.CheckboxSelectMultiple) class Meta: exclude = ['listright','gid'] @@ -284,7 +284,12 @@ class RightForm(ModelForm): class DelRightForm(ModelForm): - rights = forms.ModelMultipleChoiceField(queryset=Right.objects.all(), label="Droits actuels", widget=forms.CheckboxSelectMultiple) + rights = forms.ModelMultipleChoiceField(queryset=Right.objects.all(), widget=forms.CheckboxSelectMultiple) + + def __init__(self, right, *args, **kwargs): + super(DelRightForm, self).__init__(*args, **kwargs) + self.fields['rights'].queryset = Right.objects.filter(right=right) + class Meta: model = Right diff --git a/users/models.py b/users/models.py index 0caa21ff..e0477a1d 100644 --- a/users/models.py +++ b/users/models.py @@ -461,7 +461,7 @@ class Right(models.Model): unique_together = ("user", "right") def __str__(self): - return str(self.user) + " - " + str(self.right) + return str(self.user) @receiver(post_save, sender=Right) def right_post_save(sender, **kwargs): diff --git a/users/templates/users/del_right.html b/users/templates/users/del_right.html new file mode 100644 index 00000000..740778a2 --- /dev/null +++ b/users/templates/users/del_right.html @@ -0,0 +1,58 @@ +{% extends "users/sidebar.html" %} +{% comment %} +Re2o est un logiciel d'administration développé initiallement au rezometz. Il +se veut agnostique au réseau considéré, de manière à être installable en +quelques clics. + +Copyright © 2017 Gabriel Détraz +Copyright © 2017 Goulven Kermarec +Copyright © 2017 Augustin Lemesle + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License along +with this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +{% endcomment %} + +{% load bootstrap3 %} + +{% block title %}Création et modification d'utilisateur{% endblock %} + + +{% block content %} + +