update
This commit is contained in:
parent
18dd7829d9
commit
d94c5adef7
Binary file not shown.
26
haikalbot/migrations/0001_initial.py
Normal file
26
haikalbot/migrations/0001_initial.py
Normal file
@ -0,0 +1,26 @@
|
||||
# Generated by Django 5.1.7 on 2025-04-28 12:45
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('inventory', '0006_alter_email_object_id_alter_notes_object_id'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ChatLog',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('user_message', models.TextField()),
|
||||
('chatbot_response', models.TextField()),
|
||||
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||
('dealer', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='chatlogs', to='inventory.dealer')),
|
||||
],
|
||||
),
|
||||
]
|
||||
@ -157,7 +157,7 @@ def elm(vin):
|
||||
if response.get("data"):
|
||||
data = {
|
||||
"maker": response["data"]["maker"],
|
||||
"model": response["data"]["model"],
|
||||
"model": response["data"]["model"] if response["data"]["model"] else " ",
|
||||
"modelYear": response["data"]["modelYear"],
|
||||
}
|
||||
print(data)
|
||||
|
||||
@ -284,7 +284,7 @@ def dealer_signup(request, *args, **kwargs):
|
||||
address = wf3.get("address")
|
||||
|
||||
if password != password_confirm:
|
||||
return JsonResponse({"error": "Passwords do not match."}, status=400)
|
||||
return JsonResponse({"error": _("Passwords do not match")}, status=400)
|
||||
|
||||
try:
|
||||
with transaction.atomic():
|
||||
@ -673,7 +673,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
||||
|
||||
if not vin_no or len(vin_no.strip()) != 17:
|
||||
return JsonResponse(
|
||||
{"success": False, "error": "Invalid VIN number provided."}, status=400
|
||||
{"success": False, "error": _("Invalid VIN number provided")}, status=400
|
||||
)
|
||||
|
||||
vin_no = vin_no.strip()
|
||||
@ -683,7 +683,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
||||
# manufacturer_name = model_name = year_model = None
|
||||
if not (result := decodevin(vin_no)):
|
||||
return JsonResponse(
|
||||
{"success": False, "error": "VIN not found in all sources."}, status=404
|
||||
{"success": False, "error": _("VIN not found in all sources")}, status=404
|
||||
)
|
||||
|
||||
manufacturer_name, model_name, year_model = result.values()
|
||||
@ -696,7 +696,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
||||
|
||||
if not car_make:
|
||||
return JsonResponse(
|
||||
{"success": False, "error": "Manufacturer not found in the database."},
|
||||
{"success": False, "error": _("Manufacturer not found in the database")},
|
||||
status=404,
|
||||
)
|
||||
vin_data["make_id"] = car_make.id_car_make
|
||||
@ -736,7 +736,7 @@ class AjaxHandlerView(LoginRequiredMixin, View):
|
||||
"id_car_serie", "name", "arabic_name", "generation_name"
|
||||
)
|
||||
except Exception as e:
|
||||
return JsonResponse({"error": "Server error occurred"}, status=500)
|
||||
return JsonResponse({"error": _("Server error occurred")}, status=500)
|
||||
return JsonResponse(list(series), safe=False)
|
||||
|
||||
def get_trims(self, request):
|
||||
@ -846,7 +846,7 @@ class SearchCodeView(LoginRequiredMixin, View):
|
||||
image_file = request.FILES.get("image")
|
||||
|
||||
if not image_file:
|
||||
return JsonResponse({"success": False, "error": "No image provided"})
|
||||
return JsonResponse({"success": False, "error": _("No image provided")})
|
||||
|
||||
try:
|
||||
np_arr = np.frombuffer(image_file.read(), np.uint8)
|
||||
@ -858,7 +858,7 @@ class SearchCodeView(LoginRequiredMixin, View):
|
||||
decoded_objects = decode(gray)
|
||||
|
||||
if not decoded_objects:
|
||||
return JsonResponse({"success": False, "error": "No QR/Barcode detected"})
|
||||
return JsonResponse({"success": False, "error": _("No QR/Barcode detected")})
|
||||
|
||||
code = decoded_objects[0].data.decode("utf-8").strip()
|
||||
car = get_object_or_404(models.Car, vin=code)
|
||||
@ -1275,7 +1275,7 @@ class CarFinanceUpdateView(
|
||||
model = models.CarFinance
|
||||
form_class = forms.CarFinanceForm
|
||||
template_name = "inventory/car_finance_form.html"
|
||||
success_message = _("Car finance details updated successfully.")
|
||||
success_message = _("Car finance details updated successfully")
|
||||
permission_required = ["inventory.change_carfinance"]
|
||||
|
||||
def get_success_url(self):
|
||||
@ -1327,7 +1327,7 @@ class CarUpdateView(
|
||||
model = models.Car
|
||||
form_class = forms.CarUpdateForm
|
||||
template_name = "inventory/car_edit.html"
|
||||
success_message = _("Car updated successfully.")
|
||||
success_message = _("Car updated successfully")
|
||||
permission_required = ["inventory.change_car"]
|
||||
|
||||
def get_success_url(self):
|
||||
@ -2050,7 +2050,7 @@ def CustomerCreateView(request):
|
||||
.filter(email=form.cleaned_data["email"])
|
||||
.exists()
|
||||
):
|
||||
messages.error(request, _("Customer with this email already exists."))
|
||||
messages.error(request, _("Customer with this email already exists"))
|
||||
else:
|
||||
customer_name = (
|
||||
f"{form.cleaned_data['first_name']} "
|
||||
|
||||
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user