- 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
34 lines
1.6 KiB
Python
34 lines
1.6 KiB
Python
# Generated by Django 5.2.7 on 2026-03-09 10:49
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations, models
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('evaluation', '0012_remove_quickevaluationmodel_condition_and_more'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='ReferenceitemModel',
|
|
fields=[
|
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
('created_at', models.DateTimeField(auto_now_add=True)),
|
|
('updated_at', models.DateTimeField(auto_now=True)),
|
|
('type', models.CharField(choices=[('brand', 'Brand'), ('marka', 'Marka'), ('color', 'Color'), ('fuel_type', 'Fuel type'), ('body_type', 'Body type'), ('car_position', 'Car position'), ('state_car', 'Car state')], max_length=50, verbose_name='type')),
|
|
('name', models.CharField(max_length=255, verbose_name='name')),
|
|
('order', models.IntegerField(default=0, verbose_name='order')),
|
|
('is_active', models.BooleanField(default=True, verbose_name='is active')),
|
|
('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='evaluation.referenceitemmodel', verbose_name='parent')),
|
|
],
|
|
options={
|
|
'verbose_name': 'Reference Item',
|
|
'verbose_name_plural': 'Reference Items',
|
|
'db_table': 'ReferenceItem',
|
|
'ordering': ['type', 'order', 'name'],
|
|
},
|
|
),
|
|
]
|