- 10 ta yangi choice klass qo'shildi: ObjectOwnerType, PropertyRights, FormOwnership, LocationHighways, LocationConvenience, AutoCarType, AutoCarWheel - AutoEvaluationModel ga ~30 ta yangi field qo'shildi (4 bosqich): 1-bosqich: ro'yxatga olish raqami, sanalar, ob'ekt turi 2-bosqich: egasi ma'lumotlari (jismoniy/yuridik), mulk huquqi, egalik shakli 3-bosqich: manzil (viloyat, tuman, shahar, mahalla, ko'cha, uy) 4-bosqich: avtomobil (tex passport, marka, model, raqam, rang, dvigatel) - CreateSerializer ga validatsiya qo'shildi: passport formati (AA 1234567), tex passport formati (AAA 1234567), egasi turiga qarab majburiy fieldlar (jismoniy yoki yuridik) - View ReadOnlyModelViewSet dan ModelViewSet ga o'zgartirildi - Admin 4 bosqichli fieldset bilan yangilandi - Yangi filterlar: object_owner_type, property_rights, form_ownership - VehicleModel fieldlari FK → ReferenceitemModel ga o'tkazildi - Migratsiyalar: 0015, 0016, 0017
62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
from django.contrib import admin
|
|
from unfold.admin import ModelAdmin
|
|
|
|
from core.apps.evaluation.models import VehicleModel
|
|
|
|
|
|
@admin.register(VehicleModel)
|
|
class VehicleAdmin(ModelAdmin):
|
|
list_display = (
|
|
"id",
|
|
"brand",
|
|
"model",
|
|
"license_plate",
|
|
"manufacture_year",
|
|
"color",
|
|
"fuel_type",
|
|
"condition",
|
|
"mileage",
|
|
)
|
|
list_filter = (
|
|
"condition",
|
|
"manufacture_year",
|
|
)
|
|
search_fields = (
|
|
"brand__name",
|
|
"model__name",
|
|
"license_plate",
|
|
"vin_number",
|
|
"engine_number",
|
|
"tech_passport_number",
|
|
)
|
|
readonly_fields = ("created_at", "updated_at")
|
|
autocomplete_fields = ("brand", "model", "color", "fuel_type", "body_type", "position")
|
|
fieldsets = (
|
|
("Texnik passport", {
|
|
"fields": (
|
|
("tech_passport_series", "tech_passport_number"),
|
|
("tech_passport_issued_date", "tech_passport_issued_by"),
|
|
),
|
|
}),
|
|
("Transport ma'lumotlari", {
|
|
"fields": (
|
|
("brand", "model"),
|
|
"license_plate",
|
|
("manufacture_year", "color"),
|
|
("vin_number", "engine_number"),
|
|
"position",
|
|
),
|
|
}),
|
|
("Texnik holat", {
|
|
"fields": (
|
|
("fuel_type", "body_type"),
|
|
"condition",
|
|
"mileage",
|
|
),
|
|
}),
|
|
("Tizim", {
|
|
"classes": ("collapse",),
|
|
"fields": ("created_at", "updated_at"),
|
|
}),
|
|
)
|