diff --git a/myproject/customers/views.py b/myproject/customers/views.py index baa331f..f13cac6 100644 --- a/myproject/customers/views.py +++ b/myproject/customers/views.py @@ -382,9 +382,14 @@ def api_create_customer(request): try: data = json.loads(request.body) - name = data.get('name', '').strip() - phone = data.get('phone', '').strip() - email = data.get('email', '').strip() + name = data.get('name', '') + phone = data.get('phone') + email = data.get('email', '') + + # Нормализуем строки (может быть None из JavaScript) + name = name.strip() if name else '' + phone = phone.strip() if phone else '' + email = email.strip() if email else '' # Валидация: имя обязательно if not name: