Fix: проверка self.object при создании заказа клиента (500)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-25 15:12:57 +00:00
parent c82a69c3ce
commit a181413dda
2 changed files with 9 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ class CustomerOrderCreate(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs):
ctx = super().get_context_data(**kwargs)
ctx["formset"] = CustomerOrderItemFormSet(instance=self.object) if self.object.pk else CustomerOrderItemFormSet()
ctx["formset"] = CustomerOrderItemFormSet(instance=self.object) if self.object and self.object.pk else CustomerOrderItemFormSet()
ctx["title"] = "Заказ клиента"
return ctx