mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Ne réinvente pas la roue
This commit is contained in:
parent
4a5fd06ace
commit
8a19977757
1 changed files with 2 additions and 10 deletions
|
@ -454,23 +454,15 @@ class GroupForm(FormRevMixin, ModelForm):
|
|||
widget=forms.CheckboxSelectMultiple,
|
||||
required=False
|
||||
)
|
||||
superuser = forms.BooleanField(
|
||||
label="Superuser",
|
||||
required=False,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = User
|
||||
fields = ['groups']
|
||||
fields = ['groups', 'is_superuser']
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||
super(GroupForm, self).__init__(*args, prefix=prefix, **kwargs)
|
||||
self.fields['superuser'].initial = self.instance.is_superuser
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
self.instance.is_superuser = self.cleaned_data['superuser']
|
||||
return super(GroupForm, self).save(*args, **kwargs)
|
||||
self.fields['is_superuser'].label = "Superuser"
|
||||
|
||||
|
||||
class SchoolForm(FormRevMixin, ModelForm):
|
||||
|
|
Loading…
Reference in a new issue