Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Move up the staff form meta class

NyanKiyoshi518d7f459507
diff --git a/saleor/dashboard/staff/forms.py b/saleor/dashboard/staff/forms.py
index 0702d489df..649e275ce4 100644
--- a/saleor/dashboard/staff/forms.py
+++ b/saleor/dashboard/staff/forms.py
@@ -13,13 +13,6 @@ class StaffForm(forms.ModelForm):
label=pgettext_lazy(
'Label above the permissions choicefield', 'Permissions'))
- def __init__(self, *args, **kwargs):
- self.user = kwargs.pop('user', None)
- super().__init__(*args, **kwargs)
- self.instance.is_staff = True
- if self.user == self.instance:
- self.fields['is_active'].disabled = True
-
class Meta:
model = User
fields = ['email', 'user_permissions', 'is_active']
@@ -28,3 +21,10 @@ class StaffForm(forms.ModelForm):
'Email', 'Email'),
'is_active': pgettext_lazy(
'User active toggle', 'User is active')}
+
+ def __init__(self, *args, **kwargs):
+ self.user = kwargs.pop('user', None)
+ super().__init__(*args, **kwargs)
+ self.instance.is_staff = True
+ if self.user == self.instance:
+ self.fields['is_active'].disabled = True