mirror of
https://github.com/daniviga/django-ram.git
synced 2026-02-03 17:40:39 +01:00
Minor improvements
This commit is contained in:
@@ -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"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
||||||
@@ -30,7 +30,7 @@ class Property(SimpleBaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class Manufacturer(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)
|
slug = models.CharField(max_length=128, unique=True, editable=False)
|
||||||
category = models.CharField(
|
category = models.CharField(
|
||||||
max_length=64, choices=settings.MANUFACTURER_TYPES
|
max_length=64, choices=settings.MANUFACTURER_TYPES
|
||||||
@@ -46,6 +46,12 @@ class Manufacturer(SimpleBaseModel):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["category", "slug"]
|
ordering = ["category", "slug"]
|
||||||
|
constraints = [
|
||||||
|
models.UniqueConstraint(
|
||||||
|
fields=["name", "category"],
|
||||||
|
name="unique_name_category"
|
||||||
|
)
|
||||||
|
]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class RollingClassPropertyInline(admin.TabularInline):
|
|||||||
class RollingClass(admin.ModelAdmin):
|
class RollingClass(admin.ModelAdmin):
|
||||||
inlines = (RollingClassPropertyInline,)
|
inlines = (RollingClassPropertyInline,)
|
||||||
autocomplete_fields = ("manufacturer",)
|
autocomplete_fields = ("manufacturer",)
|
||||||
list_display = ("__str__", "type", "company", "country_flag")
|
list_display = ("__str__", "identifier", "type", "company", "country_flag")
|
||||||
list_filter = ("company", "type__category", "type")
|
list_filter = ("company", "type__category", "type")
|
||||||
search_fields = (
|
search_fields = (
|
||||||
"identifier",
|
"identifier",
|
||||||
|
|||||||
Reference in New Issue
Block a user