RealEstateEvaluationModel modeli qoshildi (Ko'chmas mulk (Real Estate) baholash modeli uchun quyidagicha nomlarni tavsiya qilaman:
)
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
from .auto import * # noqa
|
||||
from .real_estate import * # noqa
|
||||
|
||||
from .customer import * # noqa
|
||||
from .real_estate import * # noqa
|
||||
from .valuation import * # noqa
|
||||
from .vehicle import * # noqa
|
||||
from .auto import * # noqa
|
||||
|
||||
68
core/apps/evaluation/models/real_estate.py
Normal file
68
core/apps/evaluation/models/real_estate.py
Normal file
@@ -0,0 +1,68 @@
|
||||
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 .valuation import ValuationModel
|
||||
from core.apps.evaluation.choices.real_estate import PropertyType, RealEstateCondition
|
||||
|
||||
|
||||
|
||||
|
||||
class RealEstateEvaluationModel(AbstractBaseModel):
|
||||
valuation = models.OneToOneField(
|
||||
ValuationModel,
|
||||
on_delete=models.CASCADE,
|
||||
related_name="real_estate_detail",
|
||||
verbose_name=_("valuation"),
|
||||
)
|
||||
property_type = models.CharField(
|
||||
verbose_name=_("property type"),
|
||||
max_length=50,
|
||||
choices=PropertyType.choices,
|
||||
default=PropertyType.APARTMENT,
|
||||
)
|
||||
address = models.TextField(verbose_name=_("address"))
|
||||
cadastral_number = models.CharField(
|
||||
verbose_name=_("cadastral number"), max_length=50, blank=True, null=True
|
||||
)
|
||||
total_area = models.DecimalField(
|
||||
verbose_name=_("total area"), max_digits=12, decimal_places=2
|
||||
)
|
||||
living_area = models.DecimalField(
|
||||
verbose_name=_("living area"),
|
||||
max_digits=12,
|
||||
decimal_places=2,
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
floor = models.IntegerField(verbose_name=_("floor"), blank=True, null=True)
|
||||
total_floors = models.IntegerField(
|
||||
verbose_name=_("total floors"), blank=True, null=True
|
||||
)
|
||||
rooms_count = models.IntegerField(
|
||||
verbose_name=_("rooms count"), blank=True, null=True
|
||||
)
|
||||
build_year = models.IntegerField(verbose_name=_("build year"), blank=True, null=True)
|
||||
condition = models.CharField(
|
||||
verbose_name=_("condition"),
|
||||
max_length=50,
|
||||
choices=RealEstateCondition.choices,
|
||||
blank=True,
|
||||
null=True,
|
||||
)
|
||||
has_renovation = models.BooleanField(verbose_name=_("has renovation"), default=False)
|
||||
|
||||
def __str__(self):
|
||||
return f"Real Estate Evaluation for {self.valuation}"
|
||||
|
||||
@classmethod
|
||||
def _baker(cls):
|
||||
return baker.make(cls)
|
||||
|
||||
class Meta:
|
||||
db_table = "RealEstateEvaluation"
|
||||
verbose_name = _("Real Estate Evaluation")
|
||||
verbose_name_plural = _("Real Estate Evaluations")
|
||||
|
||||
Reference in New Issue
Block a user