hamma modellarda get serizlizers uchun fiedl qoshilfi
This commit is contained in:
114
API_ENDPOINTS.md
Normal file
114
API_ENDPOINTS.md
Normal file
@@ -0,0 +1,114 @@
|
|||||||
|
# SifatBaho — GET API Endpoints
|
||||||
|
|
||||||
|
> Barcha endpointlar hozirda `AllowAny` permission bilan ishlaydi.
|
||||||
|
> Token yuborish shart emas (hozircha).
|
||||||
|
> Base URL: `http://localhost:8000/api/v1/`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔐 Auth (Autentifikatsiya)
|
||||||
|
|
||||||
|
| # | URL | Method | Tavsif |
|
||||||
|
|---|-----|--------|--------|
|
||||||
|
| 1 | `api/v1/auth/token/` | POST | Login — access va refresh token olish |
|
||||||
|
| 2 | `api/v1/auth/token/refresh/` | POST | Access tokenni yangilash |
|
||||||
|
| 3 | `api/v1/auth/token/verify/` | POST | Tokenni tekshirish |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 👤 Buyurtmachilar
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 1 | `api/v1/customer/` | GET | ❌ | Barcha buyurtmachilar ro'yxati (ism, INN, JSHSHIR) |
|
||||||
|
| 2 | `api/v1/customer/{id}/` | GET | ❌ | Bitta buyurtmachining to'liq ma'lumotlari (passport, manzil, bank) |
|
||||||
|
| 3 | `api/v1/property-owner/` | GET | ❌ | Barcha mulk egalari ro'yxati |
|
||||||
|
| 4 | `api/v1/property-owner/{id}/` | GET | ❌ | Bitta mulk egasining to'liq ma'lumotlari |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📋 Arizalar (Valuation)
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 5 | `api/v1/valuation/` | GET | ❌ | Barcha arizalar ro'yxati (raqam, tur, status, narx) |
|
||||||
|
| 6 | `api/v1/valuation/{id}/` | GET | ❌ | Bitta arizaning to'liq ma'lumotlari (buyurtmachi, baholovchi, narxlar) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚗 Transport vositalari
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 7 | `api/v1/vehicle/` | GET | ❌ | Barcha transportlar ro'yxati (marka, model, raqam, rang) |
|
||||||
|
| 8 | `api/v1/vehicle/{id}/` | GET | ❌ | Bitta transportning to'liq ma'lumotlari (VIN, tex passport, yurgan km) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔧 Avto baholash
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 9 | `api/v1/auto-evaluation/` | GET | ❌ | Barcha avto baholashlar (ariza + moshina bog'lanishi) |
|
||||||
|
| 10 | `api/v1/auto-evaluation/{id}/` | GET | ❌ | Bitta avto baholash detali (ariza va moshina to'liq) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🏠 Ko'chmas mulk baholash
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 11 | `api/v1/real-estate-evaluation/` | GET | ❌ | Barcha ko'chmas mulk baholashlar (tur, manzil, maydon) |
|
||||||
|
| 12 | `api/v1/real-estate-evaluation/{id}/` | GET | ❌ | Bitta ko'chmas mulk detali (kadastr, qavat, xonalar) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📦 Ko'char mulk baholash
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 13 | `api/v1/movable-property-evaluation/` | GET | ❌ | Barcha ko'char mulk baholashlar (nomi, kategoriya, soni) |
|
||||||
|
| 14 | `api/v1/movable-property-evaluation/{id}/` | GET | ❌ | Bitta ko'char mulk detali (seriya raqami, holat) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚡ Tezkor baholash
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 15 | `api/v1/quick-evaluation/` | GET | ❌ | Barcha tezkor baholashlar (marka, model, taxminiy narx) |
|
||||||
|
| 16 | `api/v1/quick-evaluation/{id}/` | GET | ❌ | Bitta tezkor baholash detali (VIN, yoqilg'i turi, holat) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📄 Hisobotlar
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 17 | `api/v1/evaluation-report/` | GET | ❌ | Barcha hisobotlar ro'yxati (raqam, baholovchi, yakuniy narx) |
|
||||||
|
| 18 | `api/v1/evaluation-report/{id}/` | GET | ❌ | Bitta hisobot detali (xulosa matni, PDF fayl) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📎 Ariza hujjatlari
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 19 | `api/v1/valuation-document/` | GET | ❌ | Barcha hujjatlar ro'yxati (turi, sarlavha, fayl) |
|
||||||
|
| 20 | `api/v1/valuation-document/{id}/` | GET | ❌ | Bitta hujjat detali (tavsif, kim yuklagan) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💳 To'lovlar
|
||||||
|
|
||||||
|
| # | URL | Method | Token | Tavsif |
|
||||||
|
|---|-----|--------|-------|--------|
|
||||||
|
| 21 | `api/v1/payment/` | GET | ❌ | Barcha to'lovlar ro'yxati (summa, usul, status) |
|
||||||
|
| 22 | `api/v1/payment/{id}/` | GET | ❌ | Bitta to'lov detali (tranzaksiya ID, izoh) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Jami: 22 ta GET endpoint** (11 ta List + 11 ta Detail)
|
||||||
|
|
||||||
|
> ⚠️ Hozir barcha endpointlar `AllowAny` — token kerak emas.
|
||||||
|
> Keyinchalik `IsAuthenticated` ga o'zgartiriladi.
|
||||||
@@ -15,6 +15,7 @@ class CustomUserAdmin(admin.UserAdmin, ModelAdmin):
|
|||||||
"phone",
|
"phone",
|
||||||
"role",
|
"role",
|
||||||
)
|
)
|
||||||
|
search_fields = ("phone", "first_name", "last_name", "username")
|
||||||
autocomplete_fields = ["groups", "user_permissions"]
|
autocomplete_fields = ["groups", "user_permissions"]
|
||||||
fieldsets = ((None, {"fields": ("phone",)}),) + (
|
fieldsets = ((None, {"fields": ("phone",)}),) + (
|
||||||
(None, {"fields": ("username", "password")}),
|
(None, {"fields": ("username", "password")}),
|
||||||
@@ -37,7 +38,7 @@ class CustomUserAdmin(admin.UserAdmin, ModelAdmin):
|
|||||||
|
|
||||||
|
|
||||||
class PermissionAdmin(ModelAdmin):
|
class PermissionAdmin(ModelAdmin):
|
||||||
list_display = ("name",)
|
list_display = ("name",)
|
||||||
search_fields = ("name",)
|
search_fields = ("name",)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class AutoEvaluationAdmin(ModelAdmin):
|
|||||||
"vehicle__license_plate",
|
"vehicle__license_plate",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("valuation", "vehicle")
|
autocomplete_fields = ("valuation", "vehicle")
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Bog'lanishlar", {
|
("Bog'lanishlar", {
|
||||||
"fields": ("valuation", "vehicle"),
|
"fields": ("valuation", "vehicle"),
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class ValuationDocumentAdmin(ModelAdmin):
|
|||||||
"valuation__conclusion_number",
|
"valuation__conclusion_number",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("valuation", "uploaded_by")
|
autocomplete_fields = ("valuation", "uploaded_by")
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Hujjat", {
|
("Hujjat", {
|
||||||
"fields": (
|
"fields": (
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ class MovablePropertyEvaluationAdmin(ModelAdmin):
|
|||||||
"valuation__conclusion_number",
|
"valuation__conclusion_number",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("valuation",)
|
autocomplete_fields = ("valuation",)
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Ariza", {
|
("Ariza", {
|
||||||
"fields": ("valuation",),
|
"fields": ("valuation",),
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class QuickEvaluationAdmin(ModelAdmin):
|
|||||||
"tech_passport_number",
|
"tech_passport_number",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("created_by",)
|
autocomplete_fields = ("created_by",)
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Foydalanuvchi", {
|
("Foydalanuvchi", {
|
||||||
"fields": ("created_by",),
|
"fields": ("created_by",),
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class RealEstateEvaluationAdmin(ModelAdmin):
|
|||||||
"valuation__conclusion_number",
|
"valuation__conclusion_number",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("valuation",)
|
autocomplete_fields = ("valuation",)
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Ariza", {
|
("Ariza", {
|
||||||
"fields": ("valuation",),
|
"fields": ("valuation",),
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class EvaluationReportAdmin(ModelAdmin):
|
|||||||
"conclusion_text",
|
"conclusion_text",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("valuation", "evaluator")
|
autocomplete_fields = ("valuation", "evaluator")
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Hisobot", {
|
("Hisobot", {
|
||||||
"fields": (
|
"fields": (
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class ValuationAdmin(ModelAdmin):
|
|||||||
"customer__inn",
|
"customer__inn",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("customer", "property_owner", "created_by", "assigned_to")
|
autocomplete_fields = ("customer", "property_owner", "created_by", "assigned_to")
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("Asosiy ma'lumotlar", {
|
("Asosiy ma'lumotlar", {
|
||||||
"fields": (
|
"fields": (
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ from core.apps.evaluation.choices.real_estate import PropertyType, RealEstateCon
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RealEstateEvaluationModel(AbstractBaseModel):
|
class RealEstateEvaluationModel(AbstractBaseModel):
|
||||||
valuation = models.OneToOneField(
|
valuation = models.OneToOneField(
|
||||||
ValuationModel,
|
"evaluation.ValuationModel",
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
related_name="real_estate_detail",
|
related_name="real_estate_detail",
|
||||||
verbose_name=_("valuation"),
|
verbose_name=_("valuation"),
|
||||||
)
|
)
|
||||||
|
|
||||||
property_type = models.CharField(
|
property_type = models.CharField(
|
||||||
verbose_name=_("property type"),
|
verbose_name=_("property type"),
|
||||||
max_length=50,
|
max_length=50,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import AutoEvaluationModel
|
from core.apps.evaluation.models import AutoEvaluationModel
|
||||||
|
from core.apps.evaluation.serializers.valuation.Valuation import ListValuationSerializer
|
||||||
|
from core.apps.evaluation.serializers.vehicle.Vehicle import ListVehicleSerializer
|
||||||
|
|
||||||
class BaseAutoevaluationSerializer(serializers.ModelSerializer):
|
class BaseAutoevaluationSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
@@ -12,19 +12,34 @@ class BaseAutoevaluationSerializer(serializers.ModelSerializer):
|
|||||||
"vehicle",
|
"vehicle",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListAutoevaluationSerializer(BaseAutoevaluationSerializer):
|
class ListAutoevaluationSerializer(BaseAutoevaluationSerializer):
|
||||||
class Meta(BaseAutoevaluationSerializer.Meta): ...
|
valuation_info = ListValuationSerializer(source="valuation", read_only=True)
|
||||||
|
vehicle_info = ListVehicleSerializer(source="vehicle", read_only=True)
|
||||||
|
|
||||||
|
class Meta(BaseAutoevaluationSerializer.Meta):
|
||||||
|
fields = BaseAutoevaluationSerializer.Meta.fields + [
|
||||||
|
"valuation_info",
|
||||||
|
"vehicle_info",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrieveAutoevaluationSerializer(BaseAutoevaluationSerializer):
|
class RetrieveAutoevaluationSerializer(BaseAutoevaluationSerializer):
|
||||||
class Meta(BaseAutoevaluationSerializer.Meta): ...
|
from core.apps.evaluation.serializers.valuation.Valuation import RetrieveValuationSerializer
|
||||||
|
from core.apps.evaluation.serializers.vehicle.Vehicle import RetrieveVehicleSerializer
|
||||||
|
|
||||||
|
valuation_detail = RetrieveValuationSerializer(source="valuation", read_only=True)
|
||||||
|
vehicle_detail = RetrieveVehicleSerializer(source="vehicle", read_only=True)
|
||||||
|
|
||||||
|
class Meta(BaseAutoevaluationSerializer.Meta):
|
||||||
|
fields = BaseAutoevaluationSerializer.Meta.fields + [
|
||||||
|
"valuation_detail",
|
||||||
|
"vehicle_detail",
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateAutoevaluationSerializer(BaseAutoevaluationSerializer):
|
class CreateAutoevaluationSerializer(BaseAutoevaluationSerializer):
|
||||||
class Meta(BaseAutoevaluationSerializer.Meta):
|
class Meta(BaseAutoevaluationSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
|
||||||
"valuation",
|
"valuation",
|
||||||
"vehicle",
|
"vehicle",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,27 +1,70 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import CustomerModel
|
from core.apps.evaluation.models import CustomerModel
|
||||||
|
|
||||||
|
|
||||||
class BaseCustomerSerializer(serializers.ModelSerializer):
|
class BaseCustomerSerializer(serializers.ModelSerializer):
|
||||||
|
customer_type_display = serializers.CharField(source="get_customer_type_display", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CustomerModel
|
model = CustomerModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
|
"customer_type",
|
||||||
|
"customer_type_display",
|
||||||
|
"jshshir",
|
||||||
|
"passport_series",
|
||||||
|
"passport_number",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"middle_name",
|
||||||
|
"inn",
|
||||||
|
"org_name",
|
||||||
|
"created_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListCustomerSerializer(BaseCustomerSerializer):
|
class ListCustomerSerializer(BaseCustomerSerializer):
|
||||||
class Meta(BaseCustomerSerializer.Meta): ...
|
class Meta(BaseCustomerSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"customer_type_display",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"org_name",
|
||||||
|
"inn",
|
||||||
|
"jshshir",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrieveCustomerSerializer(BaseCustomerSerializer):
|
class RetrieveCustomerSerializer(BaseCustomerSerializer):
|
||||||
class Meta(BaseCustomerSerializer.Meta): ...
|
class Meta(BaseCustomerSerializer.Meta):
|
||||||
|
fields = BaseCustomerSerializer.Meta.fields + [
|
||||||
|
"address",
|
||||||
|
"passport_issued_date",
|
||||||
|
"passport_issued_by",
|
||||||
|
"org_address",
|
||||||
|
"director_name",
|
||||||
|
"mfo",
|
||||||
|
"bank_account",
|
||||||
|
"certificate_file",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateCustomerSerializer(BaseCustomerSerializer):
|
class CreateCustomerSerializer(BaseCustomerSerializer):
|
||||||
class Meta(BaseCustomerSerializer.Meta):
|
class Meta(BaseCustomerSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"customer_type",
|
||||||
|
"jshshir",
|
||||||
|
"passport_series",
|
||||||
|
"passport_number",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"middle_name",
|
||||||
|
"address",
|
||||||
|
"passport_issued_date",
|
||||||
|
"passport_issued_by",
|
||||||
|
"inn",
|
||||||
|
"org_name",
|
||||||
|
"org_address",
|
||||||
|
"director_name",
|
||||||
|
"mfo",
|
||||||
|
"bank_account",
|
||||||
|
"certificate_file",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,27 +1,70 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import PropertyOwnerModel
|
from core.apps.evaluation.models import PropertyOwnerModel
|
||||||
|
|
||||||
|
|
||||||
class BasePropertyOwnerSerializer(serializers.ModelSerializer):
|
class BasePropertyOwnerSerializer(serializers.ModelSerializer):
|
||||||
|
owner_type_display = serializers.CharField(source="get_owner_type_display", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PropertyOwnerModel
|
model = PropertyOwnerModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
|
"owner_type",
|
||||||
|
"owner_type_display",
|
||||||
|
"jshshir",
|
||||||
|
"passport_series",
|
||||||
|
"passport_number",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"middle_name",
|
||||||
|
"inn",
|
||||||
|
"org_name",
|
||||||
|
"created_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListPropertyOwnerSerializer(BasePropertyOwnerSerializer):
|
class ListPropertyOwnerSerializer(BasePropertyOwnerSerializer):
|
||||||
class Meta(BasePropertyOwnerSerializer.Meta): ...
|
class Meta(BasePropertyOwnerSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"owner_type_display",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"org_name",
|
||||||
|
"inn",
|
||||||
|
"jshshir",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrievePropertyOwnerSerializer(BasePropertyOwnerSerializer):
|
class RetrievePropertyOwnerSerializer(BasePropertyOwnerSerializer):
|
||||||
class Meta(BasePropertyOwnerSerializer.Meta): ...
|
class Meta(BasePropertyOwnerSerializer.Meta):
|
||||||
|
fields = BasePropertyOwnerSerializer.Meta.fields + [
|
||||||
|
"address",
|
||||||
|
"passport_issued_date",
|
||||||
|
"passport_issued_by",
|
||||||
|
"org_address",
|
||||||
|
"director_name",
|
||||||
|
"mfo",
|
||||||
|
"bank_account",
|
||||||
|
"certificate_file",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreatePropertyOwnerSerializer(BasePropertyOwnerSerializer):
|
class CreatePropertyOwnerSerializer(BasePropertyOwnerSerializer):
|
||||||
class Meta(BasePropertyOwnerSerializer.Meta):
|
class Meta(BasePropertyOwnerSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"owner_type",
|
||||||
|
"jshshir",
|
||||||
|
"passport_series",
|
||||||
|
"passport_number",
|
||||||
|
"first_name",
|
||||||
|
"last_name",
|
||||||
|
"middle_name",
|
||||||
|
"address",
|
||||||
|
"passport_issued_date",
|
||||||
|
"passport_issued_by",
|
||||||
|
"inn",
|
||||||
|
"org_name",
|
||||||
|
"org_address",
|
||||||
|
"director_name",
|
||||||
|
"mfo",
|
||||||
|
"bank_account",
|
||||||
|
"certificate_file",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,47 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import ValuationDocumentModel
|
from core.apps.evaluation.models import ValuationDocumentModel
|
||||||
|
|
||||||
|
|
||||||
class BaseValuationdocumentSerializer(serializers.ModelSerializer):
|
class BaseValuationdocumentSerializer(serializers.ModelSerializer):
|
||||||
|
document_type_display = serializers.CharField(source="get_document_type_display", read_only=True)
|
||||||
|
uploaded_by_name = serializers.CharField(source="uploaded_by.get_full_name", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ValuationDocumentModel
|
model = ValuationDocumentModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
|
"valuation",
|
||||||
"document_type",
|
"document_type",
|
||||||
|
"document_type_display",
|
||||||
|
"title",
|
||||||
|
"file",
|
||||||
|
"uploaded_by",
|
||||||
|
"uploaded_by_name",
|
||||||
|
"created_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListValuationdocumentSerializer(BaseValuationdocumentSerializer):
|
class ListValuationdocumentSerializer(BaseValuationdocumentSerializer):
|
||||||
class Meta(BaseValuationdocumentSerializer.Meta): ...
|
class Meta(BaseValuationdocumentSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"valuation",
|
||||||
|
"document_type_display",
|
||||||
|
"title",
|
||||||
|
"file",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrieveValuationdocumentSerializer(BaseValuationdocumentSerializer):
|
class RetrieveValuationdocumentSerializer(BaseValuationdocumentSerializer):
|
||||||
class Meta(BaseValuationdocumentSerializer.Meta): ...
|
class Meta(BaseValuationdocumentSerializer.Meta):
|
||||||
|
fields = BaseValuationdocumentSerializer.Meta.fields + [
|
||||||
|
"description",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateValuationdocumentSerializer(BaseValuationdocumentSerializer):
|
class CreateValuationdocumentSerializer(BaseValuationdocumentSerializer):
|
||||||
class Meta(BaseValuationdocumentSerializer.Meta):
|
class Meta(BaseValuationdocumentSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"valuation",
|
||||||
"document_type",
|
"document_type",
|
||||||
|
"title",
|
||||||
|
"file",
|
||||||
|
"description",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,28 +1,50 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import MovablePropertyEvaluationModel
|
from core.apps.evaluation.models import MovablePropertyEvaluationModel
|
||||||
|
|
||||||
|
|
||||||
class BaseMovablepropertyevaluationSerializer(serializers.ModelSerializer):
|
class BaseMovablepropertyevaluationSerializer(serializers.ModelSerializer):
|
||||||
|
property_category_display = serializers.CharField(source="get_property_category_display", read_only=True)
|
||||||
|
condition_display = serializers.CharField(source="get_condition_display", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = MovablePropertyEvaluationModel
|
model = MovablePropertyEvaluationModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
# "name",
|
"valuation",
|
||||||
|
"property_name",
|
||||||
|
"property_category",
|
||||||
|
"property_category_display",
|
||||||
|
"serial_number",
|
||||||
|
"manufacture_year",
|
||||||
|
"condition",
|
||||||
|
"condition_display",
|
||||||
|
"quantity",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
class ListMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
||||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta): ...
|
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"valuation",
|
||||||
|
"property_name",
|
||||||
|
"property_category_display",
|
||||||
|
"quantity",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrieveMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
class RetrieveMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
||||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta): ...
|
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
||||||
|
fields = BaseMovablepropertyevaluationSerializer.Meta.fields + [
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
class CreateMovablepropertyevaluationSerializer(BaseMovablepropertyevaluationSerializer):
|
||||||
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
class Meta(BaseMovablepropertyevaluationSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"valuation",
|
||||||
# "name",
|
"property_name",
|
||||||
|
"property_category",
|
||||||
|
"serial_number",
|
||||||
|
"manufacture_year",
|
||||||
|
"condition",
|
||||||
|
"quantity",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,26 +1,60 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import QuickEvaluationModel
|
from core.apps.evaluation.models import QuickEvaluationModel
|
||||||
|
|
||||||
|
|
||||||
class BaseQuickevaluationSerializer(serializers.ModelSerializer):
|
class BaseQuickevaluationSerializer(serializers.ModelSerializer):
|
||||||
|
fuel_type_display = serializers.CharField(source="get_fuel_type_display", read_only=True)
|
||||||
|
body_type_display = serializers.CharField(source="get_body_type_display", read_only=True)
|
||||||
|
condition_display = serializers.CharField(source="get_condition_display", read_only=True)
|
||||||
|
created_by_name = serializers.CharField(source="created_by.get_full_name", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = QuickEvaluationModel
|
model = QuickEvaluationModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
|
"created_by",
|
||||||
|
"created_by_name",
|
||||||
|
"brand",
|
||||||
|
"model",
|
||||||
|
"license_plate",
|
||||||
|
"manufacture_year",
|
||||||
|
"estimated_price",
|
||||||
|
"created_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListQuickevaluationSerializer(BaseQuickevaluationSerializer):
|
class ListQuickevaluationSerializer(BaseQuickevaluationSerializer):
|
||||||
class Meta(BaseQuickevaluationSerializer.Meta): ...
|
class Meta(BaseQuickevaluationSerializer.Meta):
|
||||||
|
pass
|
||||||
|
|
||||||
class RetrieveQuickevaluationSerializer(BaseQuickevaluationSerializer):
|
class RetrieveQuickevaluationSerializer(BaseQuickevaluationSerializer):
|
||||||
class Meta(BaseQuickevaluationSerializer.Meta): ...
|
class Meta(BaseQuickevaluationSerializer.Meta):
|
||||||
|
fields = BaseQuickevaluationSerializer.Meta.fields + [
|
||||||
|
"tech_passport_number",
|
||||||
|
"mileage",
|
||||||
|
"vin_number",
|
||||||
|
"engine_number",
|
||||||
|
"color",
|
||||||
|
"fuel_type",
|
||||||
|
"fuel_type_display",
|
||||||
|
"body_type",
|
||||||
|
"body_type_display",
|
||||||
|
"condition",
|
||||||
|
"condition_display",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateQuickevaluationSerializer(BaseQuickevaluationSerializer):
|
class CreateQuickevaluationSerializer(BaseQuickevaluationSerializer):
|
||||||
class Meta(BaseQuickevaluationSerializer.Meta):
|
class Meta(BaseQuickevaluationSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"tech_passport_number",
|
||||||
|
"license_plate",
|
||||||
|
"model",
|
||||||
|
"brand",
|
||||||
|
"manufacture_year",
|
||||||
|
"mileage",
|
||||||
|
"vin_number",
|
||||||
|
"engine_number",
|
||||||
|
"color",
|
||||||
|
"fuel_type",
|
||||||
|
"body_type",
|
||||||
|
"condition",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import RealEstateEvaluationModel
|
from core.apps.evaluation.models import RealEstateEvaluationModel
|
||||||
|
|
||||||
|
|
||||||
class BaseRealestateevaluationSerializer(serializers.ModelSerializer):
|
class BaseRealestateevaluationSerializer(serializers.ModelSerializer):
|
||||||
|
property_type_display = serializers.CharField(source="get_property_type_display", read_only=True)
|
||||||
|
condition_display = serializers.CharField(source="get_condition_display", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = RealEstateEvaluationModel
|
model = RealEstateEvaluationModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
"valuation",
|
"valuation",
|
||||||
"property_type",
|
"property_type",
|
||||||
|
"property_type_display",
|
||||||
"address",
|
"address",
|
||||||
"cadastral_number",
|
"cadastral_number",
|
||||||
"total_area",
|
"total_area",
|
||||||
@@ -19,22 +21,31 @@ class BaseRealestateevaluationSerializer(serializers.ModelSerializer):
|
|||||||
"rooms_count",
|
"rooms_count",
|
||||||
"build_year",
|
"build_year",
|
||||||
"condition",
|
"condition",
|
||||||
|
"condition_display",
|
||||||
"has_renovation",
|
"has_renovation",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListRealestateevaluationSerializer(BaseRealestateevaluationSerializer):
|
class ListRealestateevaluationSerializer(BaseRealestateevaluationSerializer):
|
||||||
class Meta(BaseRealestateevaluationSerializer.Meta): ...
|
class Meta(BaseRealestateevaluationSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"valuation",
|
||||||
|
"property_type_display",
|
||||||
|
"address",
|
||||||
|
"total_area",
|
||||||
|
"condition_display",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrieveRealestateevaluationSerializer(BaseRealestateevaluationSerializer):
|
class RetrieveRealestateevaluationSerializer(BaseRealestateevaluationSerializer):
|
||||||
class Meta(BaseRealestateevaluationSerializer.Meta): ...
|
class Meta(BaseRealestateevaluationSerializer.Meta):
|
||||||
|
fields = BaseRealestateevaluationSerializer.Meta.fields + [
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateRealestateevaluationSerializer(BaseRealestateevaluationSerializer):
|
class CreateRealestateevaluationSerializer(BaseRealestateevaluationSerializer):
|
||||||
class Meta(BaseRealestateevaluationSerializer.Meta):
|
class Meta(BaseRealestateevaluationSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
|
||||||
"valuation",
|
"valuation",
|
||||||
"property_type",
|
"property_type",
|
||||||
"address",
|
"address",
|
||||||
|
|||||||
@@ -1,35 +1,46 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import EvaluationReportModel
|
from core.apps.evaluation.models import EvaluationReportModel
|
||||||
|
|
||||||
|
|
||||||
class BaseEvaluationreportSerializer(serializers.ModelSerializer):
|
class BaseEvaluationreportSerializer(serializers.ModelSerializer):
|
||||||
|
evaluator_name = serializers.CharField(source="evaluator.get_full_name", read_only=True)
|
||||||
|
valuation_number = serializers.CharField(source="valuation.conclusion_number", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = EvaluationReportModel
|
model = EvaluationReportModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
"valuation",
|
"valuation",
|
||||||
|
"valuation_number",
|
||||||
"evaluator",
|
"evaluator",
|
||||||
|
"evaluator_name",
|
||||||
"report_number",
|
"report_number",
|
||||||
"final_value",
|
"final_value",
|
||||||
"report_file",
|
"report_file",
|
||||||
"conclusion_text",
|
"approved_at",
|
||||||
|
"created_at",
|
||||||
|
]
|
||||||
|
|
||||||
|
class ListEvaluationreportSerializer(BaseEvaluationreportSerializer):
|
||||||
|
class Meta(BaseEvaluationreportSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"valuation_number",
|
||||||
|
"evaluator_name",
|
||||||
|
"report_number",
|
||||||
|
"final_value",
|
||||||
"approved_at",
|
"approved_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListEvaluationreportSerializer(BaseEvaluationreportSerializer):
|
|
||||||
class Meta(BaseEvaluationreportSerializer.Meta): ...
|
|
||||||
|
|
||||||
|
|
||||||
class RetrieveEvaluationreportSerializer(BaseEvaluationreportSerializer):
|
class RetrieveEvaluationreportSerializer(BaseEvaluationreportSerializer):
|
||||||
class Meta(BaseEvaluationreportSerializer.Meta): ...
|
class Meta(BaseEvaluationreportSerializer.Meta):
|
||||||
|
fields = BaseEvaluationreportSerializer.Meta.fields + [
|
||||||
|
"conclusion_text",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateEvaluationreportSerializer(BaseEvaluationreportSerializer):
|
class CreateEvaluationreportSerializer(BaseEvaluationreportSerializer):
|
||||||
class Meta(BaseEvaluationreportSerializer.Meta):
|
class Meta(BaseEvaluationreportSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
|
||||||
"valuation",
|
"valuation",
|
||||||
"evaluator",
|
"evaluator",
|
||||||
"report_number",
|
"report_number",
|
||||||
|
|||||||
@@ -1,40 +1,56 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import ValuationModel
|
from core.apps.evaluation.models import ValuationModel
|
||||||
|
|
||||||
|
|
||||||
class BaseValuationSerializer(serializers.ModelSerializer):
|
class BaseValuationSerializer(serializers.ModelSerializer):
|
||||||
|
status_display = serializers.CharField(source="get_status_display", read_only=True)
|
||||||
|
evaluation_type_display = serializers.CharField(source="get_evaluation_type_display", read_only=True)
|
||||||
|
payment_status_display = serializers.CharField(source="get_payment_status_display", read_only=True)
|
||||||
|
customer_name = serializers.CharField(source="customer.__str__", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = ValuationModel
|
model = ValuationModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
"conclusion_number",
|
"conclusion_number",
|
||||||
|
"customer",
|
||||||
|
"customer_name",
|
||||||
"evaluation_purpose",
|
"evaluation_purpose",
|
||||||
"evaluation_type",
|
"evaluation_type",
|
||||||
|
"evaluation_type_display",
|
||||||
"status",
|
"status",
|
||||||
|
"status_display",
|
||||||
"created_at",
|
"created_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListValuationSerializer(BaseValuationSerializer):
|
class ListValuationSerializer(BaseValuationSerializer):
|
||||||
class Meta(BaseValuationSerializer.Meta):
|
class Meta(BaseValuationSerializer.Meta):
|
||||||
pass
|
fields = BaseValuationSerializer.Meta.fields + [
|
||||||
|
"final_price",
|
||||||
|
"payment_status_display",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrieveValuationSerializer(BaseValuationSerializer):
|
class RetrieveValuationSerializer(BaseValuationSerializer):
|
||||||
|
created_by_name = serializers.CharField(source="created_by.get_full_name", read_only=True)
|
||||||
|
assigned_to_name = serializers.CharField(source="assigned_to.get_full_name", read_only=True)
|
||||||
|
|
||||||
class Meta(BaseValuationSerializer.Meta):
|
class Meta(BaseValuationSerializer.Meta):
|
||||||
fields = BaseValuationSerializer.Meta.fields + [
|
fields = BaseValuationSerializer.Meta.fields + [
|
||||||
"customer",
|
|
||||||
"property_owner",
|
"property_owner",
|
||||||
"created_by",
|
"created_by",
|
||||||
|
"created_by_name",
|
||||||
"assigned_to",
|
"assigned_to",
|
||||||
|
"assigned_to_name",
|
||||||
|
"evaluation_subtype",
|
||||||
"estimated_price",
|
"estimated_price",
|
||||||
"final_price",
|
"final_price",
|
||||||
"payment_status",
|
"payment_status",
|
||||||
|
"payment_status_display",
|
||||||
|
"is_courier_delivery",
|
||||||
|
"courier_extra_amount",
|
||||||
"notes",
|
"notes",
|
||||||
|
"updated_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class CreateValuationSerializer(BaseValuationSerializer):
|
class CreateValuationSerializer(BaseValuationSerializer):
|
||||||
class Meta(BaseValuationSerializer.Meta):
|
class Meta(BaseValuationSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
@@ -46,4 +62,3 @@ class CreateValuationSerializer(BaseValuationSerializer):
|
|||||||
"is_courier_delivery",
|
"is_courier_delivery",
|
||||||
"notes",
|
"notes",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.evaluation.models import VehicleModel
|
from core.apps.evaluation.models import VehicleModel
|
||||||
|
|
||||||
|
|
||||||
class BaseVehicleSerializer(serializers.ModelSerializer):
|
class BaseVehicleSerializer(serializers.ModelSerializer):
|
||||||
|
fuel_type_display = serializers.CharField(source="get_fuel_type_display", read_only=True)
|
||||||
|
body_type_display = serializers.CharField(source="get_body_type_display", read_only=True)
|
||||||
|
condition_display = serializers.CharField(source="get_condition_display", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = VehicleModel
|
model = VehicleModel
|
||||||
fields = [
|
fields = [
|
||||||
@@ -12,28 +14,59 @@ class BaseVehicleSerializer(serializers.ModelSerializer):
|
|||||||
"model",
|
"model",
|
||||||
"license_plate",
|
"license_plate",
|
||||||
"manufacture_year",
|
"manufacture_year",
|
||||||
|
"color",
|
||||||
|
"fuel_type_display",
|
||||||
|
"condition_display",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListVehicleSerializer(BaseVehicleSerializer):
|
class ListVehicleSerializer(BaseVehicleSerializer):
|
||||||
class Meta(BaseVehicleSerializer.Meta):
|
class Meta(BaseVehicleSerializer.Meta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class RetrieveVehicleSerializer(BaseVehicleSerializer):
|
class RetrieveVehicleSerializer(BaseVehicleSerializer):
|
||||||
class Meta(BaseVehicleSerializer.Meta):
|
class Meta(BaseVehicleSerializer.Meta):
|
||||||
fields = "__all__"
|
fields = [
|
||||||
|
"id",
|
||||||
|
"tech_passport_series",
|
||||||
|
"tech_passport_number",
|
||||||
|
"tech_passport_issued_date",
|
||||||
|
"tech_passport_issued_by",
|
||||||
|
"license_plate",
|
||||||
|
"model",
|
||||||
|
"brand",
|
||||||
|
"manufacture_year",
|
||||||
|
"vin_number",
|
||||||
|
"engine_number",
|
||||||
|
"color",
|
||||||
|
"mileage",
|
||||||
|
"fuel_type",
|
||||||
|
"fuel_type_display",
|
||||||
|
"body_type",
|
||||||
|
"body_type_display",
|
||||||
|
"condition",
|
||||||
|
"condition_display",
|
||||||
|
"position",
|
||||||
|
"created_at",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreateVehicleSerializer(BaseVehicleSerializer):
|
class CreateVehicleSerializer(BaseVehicleSerializer):
|
||||||
class Meta(BaseVehicleSerializer.Meta):
|
class Meta(BaseVehicleSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"tech_passport_series",
|
"tech_passport_series",
|
||||||
"tech_passport_number",
|
"tech_passport_number",
|
||||||
|
"tech_passport_issued_date",
|
||||||
|
"tech_passport_issued_by",
|
||||||
"license_plate",
|
"license_plate",
|
||||||
|
"model",
|
||||||
|
"brand",
|
||||||
|
"manufacture_year",
|
||||||
|
"vin_number",
|
||||||
|
"engine_number",
|
||||||
|
"color",
|
||||||
"mileage",
|
"mileage",
|
||||||
"fuel_type",
|
"fuel_type",
|
||||||
"body_type",
|
"body_type",
|
||||||
"condition",
|
"condition",
|
||||||
|
"position",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class PaymentAdmin(ModelAdmin):
|
|||||||
"note",
|
"note",
|
||||||
)
|
)
|
||||||
readonly_fields = ("created_at", "updated_at")
|
readonly_fields = ("created_at", "updated_at")
|
||||||
raw_id_fields = ("valuation", "payer")
|
autocomplete_fields = ("valuation", "payer")
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
("To'lov ma'lumotlari", {
|
("To'lov ma'lumotlari", {
|
||||||
"fields": (
|
"fields": (
|
||||||
|
|||||||
@@ -1,28 +1,58 @@
|
|||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from core.apps.payment.models import PaymentModel
|
from core.apps.payment.models import PaymentModel
|
||||||
|
|
||||||
|
|
||||||
class BasePaymentSerializer(serializers.ModelSerializer):
|
class BasePaymentSerializer(serializers.ModelSerializer):
|
||||||
|
payment_method_display = serializers.CharField(source="get_payment_method_display", read_only=True)
|
||||||
|
status_display = serializers.CharField(source="get_status_display", read_only=True)
|
||||||
|
payer_name = serializers.CharField(source="payer.get_full_name", read_only=True)
|
||||||
|
valuation_number = serializers.CharField(source="valuation.conclusion_number", read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = PaymentModel
|
model = PaymentModel
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
"id",
|
||||||
"valuation",
|
"valuation",
|
||||||
|
"valuation_number",
|
||||||
|
"payer",
|
||||||
|
"payer_name",
|
||||||
|
"amount",
|
||||||
|
"payment_method",
|
||||||
|
"payment_method_display",
|
||||||
|
"status",
|
||||||
|
"status_display",
|
||||||
|
"transaction_id",
|
||||||
|
"paid_at",
|
||||||
|
"created_at",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class ListPaymentSerializer(BasePaymentSerializer):
|
class ListPaymentSerializer(BasePaymentSerializer):
|
||||||
class Meta(BasePaymentSerializer.Meta): ...
|
class Meta(BasePaymentSerializer.Meta):
|
||||||
|
fields = [
|
||||||
|
"id",
|
||||||
|
"valuation_number",
|
||||||
|
"payer_name",
|
||||||
|
"amount",
|
||||||
|
"payment_method_display",
|
||||||
|
"status_display",
|
||||||
|
"paid_at",
|
||||||
|
]
|
||||||
|
|
||||||
class RetrievePaymentSerializer(BasePaymentSerializer):
|
class RetrievePaymentSerializer(BasePaymentSerializer):
|
||||||
class Meta(BasePaymentSerializer.Meta): ...
|
class Meta(BasePaymentSerializer.Meta):
|
||||||
|
fields = BasePaymentSerializer.Meta.fields + [
|
||||||
|
"note",
|
||||||
|
"updated_at",
|
||||||
|
]
|
||||||
|
|
||||||
class CreatePaymentSerializer(BasePaymentSerializer):
|
class CreatePaymentSerializer(BasePaymentSerializer):
|
||||||
class Meta(BasePaymentSerializer.Meta):
|
class Meta(BasePaymentSerializer.Meta):
|
||||||
fields = [
|
fields = [
|
||||||
"id",
|
|
||||||
"valuation",
|
"valuation",
|
||||||
|
"payer",
|
||||||
|
"amount",
|
||||||
|
"payment_method",
|
||||||
|
"status",
|
||||||
|
"transaction_id",
|
||||||
|
"paid_at",
|
||||||
|
"note",
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user