QuickEvaluationModel modeli qoshildi shu tezkor baholash uchun ishatiladi

This commit is contained in:
Husanjonazamov
2026-02-13 18:33:56 +05:00
parent 8c7861ca9f
commit 53b0737ee5
26 changed files with 359 additions and 2 deletions

View File

@@ -0,0 +1,78 @@
from django.db import models
from django.utils.translation import gettext_lazy as _
from django_core.models import AbstractBaseModel
from model_bakery import baker
from core.apps.evaluation.choices.vehicle import FuelType, BodyType, VehicleCondition
class QuickEvaluationModel(AbstractBaseModel):
created_by = models.ForeignKey(
"accounts.User",
on_delete=models.SET_NULL,
null=True,
blank=True,
related_name="quick_evaluations",
verbose_name=_("created by"),
)
tech_passport_number = models.CharField(
verbose_name=_("tech passport number"), max_length=50, blank=True, null=True
)
license_plate = models.CharField(
verbose_name=_("license plate"), max_length=20, blank=True, null=True
)
model = models.CharField(verbose_name=_("model"), max_length=255, blank=True, null=True)
brand = models.CharField(verbose_name=_("brand"), max_length=255, blank=True, null=True)
manufacture_year = models.IntegerField(
verbose_name=_("manufacture year"), blank=True, null=True
)
mileage = models.IntegerField(verbose_name=_("mileage"), blank=True, null=True)
vin_number = models.CharField(
verbose_name=_("VIN number"), max_length=50, blank=True, null=True
)
engine_number = models.CharField(
verbose_name=_("engine number"), max_length=50, blank=True, null=True
)
color = models.CharField(verbose_name=_("color"), max_length=50, blank=True, null=True)
fuel_type = models.CharField(
verbose_name=_("fuel type"),
max_length=50,
choices=FuelType.choices,
blank=True,
null=True,
)
body_type = models.CharField(
verbose_name=_("body type"),
max_length=50,
choices=BodyType.choices,
blank=True,
null=True,
)
condition = models.CharField(
verbose_name=_("condition"),
max_length=50,
choices=VehicleCondition.choices,
blank=True,
null=True,
)
estimated_price = models.DecimalField(
verbose_name=_("estimated price"),
max_digits=15,
decimal_places=2,
blank=True,
null=True,
)
def __str__(self):
return f"Quick Evaluation {self.pk} by {self.created_by}"
@classmethod
def _baker(cls):
return baker.make(cls)
class Meta:
db_table = "QuickEvaluation"
verbose_name = _("Quick Evaluation")
verbose_name_plural = _("Quick Evaluations")