From 44b93bd5e864109067d1a4a27a3a663de94e87f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniele=20Vigan=C3=B2?= Date: Sat, 2 Apr 2022 11:05:34 +0200 Subject: [PATCH] Minor admin improvements --- dcc/metadata/admin.py | 4 ++++ .../0002_alter_rollingstock_address.py | 18 ++++++++++++++++++ dcc/roster/models.py | 2 +- 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 dcc/roster/migrations/0002_alter_rollingstock_address.py diff --git a/dcc/metadata/admin.py b/dcc/metadata/admin.py index 98bd15f..1c3f400 100644 --- a/dcc/metadata/admin.py +++ b/dcc/metadata/admin.py @@ -6,11 +6,15 @@ from metadata.models import ( @admin.register(Decoder) class DecoderAdmin(admin.ModelAdmin): readonly_fields = ('image_thumbnail',) + list_display = ('__str__', 'interface') + list_filter = ('manufacturer', 'interface') @admin.register(Company) class CompanyAdmin(admin.ModelAdmin): readonly_fields = ('logo_thumbnail',) + list_display = ('name', 'country') + list_filter = list_display @admin.register(Manufacturer) diff --git a/dcc/roster/migrations/0002_alter_rollingstock_address.py b/dcc/roster/migrations/0002_alter_rollingstock_address.py new file mode 100644 index 0000000..6d4d23d --- /dev/null +++ b/dcc/roster/migrations/0002_alter_rollingstock_address.py @@ -0,0 +1,18 @@ +# Generated by Django 4.0.2 on 2022-04-01 20:32 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('roster', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='rollingstock', + name='address', + field=models.SmallIntegerField(blank=True, default=None, null=True), + ), + ] diff --git a/dcc/roster/models.py b/dcc/roster/models.py index e641df8..5a07d44 100644 --- a/dcc/roster/models.py +++ b/dcc/roster/models.py @@ -23,7 +23,7 @@ class RollingStock(models.Model): Tag, related_name='rolling_stock', blank=True) - address = models.SmallIntegerField(default=3, null=True, blank=True) + address = models.SmallIntegerField(default=None, null=True, blank=True) manufacturer = models.ForeignKey( Manufacturer, on_delete=models.CASCADE, null=True, blank=True)