Minor improvements

This commit is contained in:
2026-01-09 13:08:47 +01:00
parent 40df9eb376
commit 8d899e4d9f
3 changed files with 32 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
# Generated by Django 6.0 on 2026-01-09 12:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("metadata", "0025_alter_company_options_alter_manufacturer_options_and_more"),
]
operations = [
migrations.AlterField(
model_name="manufacturer",
name="name",
field=models.CharField(max_length=128),
),
migrations.AddConstraint(
model_name="manufacturer",
constraint=models.UniqueConstraint(
fields=("name", "category"), name="unique_name_category"
),
),
]

View File

@@ -30,7 +30,7 @@ class Property(SimpleBaseModel):
class Manufacturer(SimpleBaseModel):
name = models.CharField(max_length=128, unique=True)
name = models.CharField(max_length=128)
slug = models.CharField(max_length=128, unique=True, editable=False)
category = models.CharField(
max_length=64, choices=settings.MANUFACTURER_TYPES
@@ -46,6 +46,12 @@ class Manufacturer(SimpleBaseModel):
class Meta:
ordering = ["category", "slug"]
constraints = [
models.UniqueConstraint(
fields=["name", "category"],
name="unique_name_category"
)
]
def __str__(self):
return self.name

View File

@@ -35,7 +35,7 @@ class RollingClassPropertyInline(admin.TabularInline):
class RollingClass(admin.ModelAdmin):
inlines = (RollingClassPropertyInline,)
autocomplete_fields = ("manufacturer",)
list_display = ("__str__", "type", "company", "country_flag")
list_display = ("__str__", "identifier", "type", "company", "country_flag")
list_filter = ("company", "type__category", "type")
search_fields = (
"identifier",