Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Set is_staff as default for form in creating new staff
Unknowne77e2a80ce05
diff --git a/saleor/dashboard/staff/forms.py b/saleor/dashboard/staff/forms.pyindex 7632c2e857..4f1527573a 100644--- a/saleor/dashboard/staff/forms.py+++ b/saleor/dashboard/staff/forms.py@@ -31,7 +31,7 @@ class StaffForm(forms.ModelForm):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 = Truediff --git a/saleor/dashboard/staff/views.py b/saleor/dashboard/staff/views.pyindex 10f78ebf7c..8281b552c6 100644--- a/saleor/dashboard/staff/views.py+++ b/saleor/dashboard/staff/views.py@@ -56,7 +56,8 @@ def staff_create(request):except User.DoesNotExist:staff = User()created = True- form = StaffForm(request.POST or None, instance=staff)+ form = StaffForm(+ request.POST or None, instance=staff, initial={'is_staff': True})if form.is_valid():form.save()msg = pgettext_lazy(