Skip to content

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

Fix bug where user is passed to customer and staff creation form

Unknown73950f8a42b4
diff --git a/saleor/dashboard/customer/views.py b/saleor/dashboard/customer/views.py
index f764ffbb0b..dce3f61d64 100644
--- a/saleor/dashboard/customer/views.py
+++ b/saleor/dashboard/customer/views.py
@@ -56,7 +56,8 @@ def customer_details(request, pk):
@permission_required('account.manage_users')
def customer_create(request):
customer = User()
- form = CustomerForm(request.POST or None, instance=customer)
+ form = CustomerForm(
+ request.POST or None, instance=customer, user=request.user)
if form.is_valid():
form.save()
msg = pgettext_lazy(
diff --git a/saleor/dashboard/staff/views.py b/saleor/dashboard/staff/views.py
index 8281b552c6..3f32041523 100644
--- a/saleor/dashboard/staff/views.py
+++ b/saleor/dashboard/staff/views.py
@@ -57,7 +57,8 @@ def staff_create(request):
staff = User()
created = True
form = StaffForm(
- request.POST or None, instance=staff, initial={'is_staff': True})
+ request.POST or None,
+ instance=staff, user=request.user, initial={'is_staff': True})
if form.is_valid():
form.save()
msg = pgettext_lazy(