Skip to content

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

Add initial value to StaffForm

michal5223cd1fee02
diff --git a/saleor/dashboard/staff/forms.py b/saleor/dashboard/staff/forms.py
index e9082d2e4a..ea06cc9294 100644
--- a/saleor/dashboard/staff/forms.py
+++ b/saleor/dashboard/staff/forms.py
@@ -6,6 +6,7 @@ from ...userprofile.models import User
class StaffForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
self.admin = kwargs.pop('admin', None)
+ kwargs.update(initial={'is_staff': True})
super(StaffForm, self).__init__(*args, **kwargs)
if self.admin == self.instance:
self.fields['is_superuser'].widget.attrs['disabled'] = True
diff --git a/templates/dashboard/staff/detail.html b/templates/dashboard/staff/detail.html
index 628ee3b8ff..d9c91499aa 100644
--- a/templates/dashboard/staff/detail.html
+++ b/templates/dashboard/staff/detail.html
@@ -38,7 +38,7 @@
{% endblock %}
{% block header_extra %}
- {% if user != staff_member %}
+ {% if user != staff_member and staff_member.pk %}
<a class="dropdown-button right" href="#" data-activates="context-menu" data-constrainwidth="false">
<svg data-src="{% static "dashboard/images/more_vert.svg" %}" height="24" width="24" />
</a>