feat: add ReferenceItem model and update QuickEvaluation FKs
- Create ReferenceitemModel with type, name, parent (self FK), order, is_active fields - Add ReferenceType choices: brand, marka, color, fuel_type, body_type, car_position, state_car - Implement ReferenceItem API (list, retrieve) with filter by type/parent/is_active, search, ordering - Add ReferenceItem admin with list_filter, search, inline editing - Change QuickEvaluation FK fields from shared.OptionsModel to evaluation.ReferenceitemModel - Update serializers and views to use .name instead of .key - Add ReferenceItem to unfold admin navigation
This commit is contained in:
@@ -4,6 +4,7 @@ from .document import * # noqa
|
||||
from .movable import * # noqa
|
||||
from .quick import * # noqa
|
||||
from .real_estate import * # noqa
|
||||
from .reference import * # noqa
|
||||
from .report import * # noqa
|
||||
from .valuation import * # noqa
|
||||
from .vehicle import * # noqa
|
||||
|
||||
@@ -10,10 +10,9 @@ class QuickEvaluationAdmin(ModelAdmin):
|
||||
"id",
|
||||
"created_by",
|
||||
"brand",
|
||||
"model",
|
||||
"license_plate",
|
||||
"manufacture_year",
|
||||
"condition",
|
||||
"marka",
|
||||
"car_number",
|
||||
"car_manufactured_date",
|
||||
"estimated_price",
|
||||
"status",
|
||||
"car_type",
|
||||
@@ -21,20 +20,14 @@ class QuickEvaluationAdmin(ModelAdmin):
|
||||
"created_at",
|
||||
)
|
||||
list_filter = (
|
||||
"fuel_type",
|
||||
"body_type",
|
||||
"condition",
|
||||
"status",
|
||||
"car_type",
|
||||
"state_car",
|
||||
)
|
||||
search_fields = (
|
||||
"brand",
|
||||
"model",
|
||||
"license_plate",
|
||||
"car_number",
|
||||
"vin_number",
|
||||
"engine_number",
|
||||
"tech_passport_number",
|
||||
"tex_passport_serie_num",
|
||||
)
|
||||
readonly_fields = ("created_at", "updated_at")
|
||||
autocomplete_fields = ("created_by",)
|
||||
@@ -42,20 +35,25 @@ class QuickEvaluationAdmin(ModelAdmin):
|
||||
("Foydalanuvchi", {
|
||||
"fields": ("created_by",),
|
||||
}),
|
||||
("Tex passport", {
|
||||
"fields": (
|
||||
"tex_passport_serie_num",
|
||||
("tech_passport_issued_date", "tech_passport_issued_place"),
|
||||
"tex_passport_file",
|
||||
),
|
||||
}),
|
||||
("Transport ma'lumotlari", {
|
||||
"fields": (
|
||||
"tech_passport_number",
|
||||
"license_plate",
|
||||
("brand", "model"),
|
||||
("manufacture_year", "color"),
|
||||
"car_number",
|
||||
("brand", "marka"),
|
||||
("car_manufactured_date", "color"),
|
||||
("vin_number", "engine_number"),
|
||||
"mileage",
|
||||
("distance_covered", "car_position"),
|
||||
),
|
||||
}),
|
||||
("Texnik holat", {
|
||||
"fields": (
|
||||
("fuel_type", "body_type"),
|
||||
"condition",
|
||||
("car_type", "state_car"),
|
||||
),
|
||||
}),
|
||||
|
||||
18
core/apps/evaluation/admin/reference.py
Normal file
18
core/apps/evaluation/admin/reference.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from django.contrib import admin
|
||||
from unfold.admin import ModelAdmin
|
||||
|
||||
from core.apps.evaluation.models import ReferenceitemModel
|
||||
|
||||
|
||||
@admin.register(ReferenceitemModel)
|
||||
class ReferenceitemAdmin(ModelAdmin):
|
||||
list_display = ("id", "type", "name", "parent", "order", "is_active")
|
||||
list_filter = ("type", "is_active")
|
||||
search_fields = ("name",)
|
||||
list_editable = ("order", "is_active")
|
||||
autocomplete_fields = ("parent",)
|
||||
fieldsets = (
|
||||
(None, {
|
||||
"fields": ("type", "name", "parent", "order", "is_active"),
|
||||
}),
|
||||
)
|
||||
Reference in New Issue
Block a user