mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-24 16:03:47 +00:00
Ajout de superusers
This commit is contained in:
parent
6f3fc983ac
commit
4a5fd06ace
1 changed files with 9 additions and 0 deletions
|
@ -454,6 +454,10 @@ class GroupForm(FormRevMixin, ModelForm):
|
||||||
widget=forms.CheckboxSelectMultiple,
|
widget=forms.CheckboxSelectMultiple,
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
superuser = forms.BooleanField(
|
||||||
|
label="Superuser",
|
||||||
|
required=False,
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = User
|
model = User
|
||||||
|
@ -462,6 +466,11 @@ class GroupForm(FormRevMixin, ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
prefix = kwargs.pop('prefix', self.Meta.model.__name__)
|
||||||
super(GroupForm, self).__init__(*args, prefix=prefix, **kwargs)
|
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)
|
||||||
|
|
||||||
|
|
||||||
class SchoolForm(FormRevMixin, ModelForm):
|
class SchoolForm(FormRevMixin, ModelForm):
|
||||||
|
|
Loading…
Reference in a new issue