Run black

This commit is contained in:
2022-04-02 22:58:42 +02:00
parent 6478800f77
commit b598e38f70
27 changed files with 318 additions and 259 deletions

View File

@@ -1,12 +1,16 @@
from django.contrib import admin
from roster.models import (
RollingClass, RollingStock, RollingStockImage, RollingStockDocument)
RollingClass,
RollingStock,
RollingStockImage,
RollingStockDocument,
)
@admin.register(RollingClass)
class RollingClass(admin.ModelAdmin):
list_display = ('__str__', 'type', 'company')
list_filter = ('company', 'type__category', 'type')
list_display = ("__str__", "type", "company")
list_filter = ("company", "type__category", "type")
search_fields = list_display
@@ -20,38 +24,58 @@ class RollingStockImageInline(admin.TabularInline):
model = RollingStockImage
min_num = 0
extra = 0
readonly_fields = ('image_thumbnail',)
readonly_fields = ("image_thumbnail",)
@admin.register(RollingStock)
class RollingStockAdmin(admin.ModelAdmin):
inlines = (RollingStockImageInline, RollingStockDocInline)
readonly_fields = ('creation_time', 'updated_time')
readonly_fields = ("creation_time", "updated_time")
list_display = (
'__str__', 'address', 'manufacturer',
'scale', 'sku', 'company', 'country')
"__str__",
"address",
"manufacturer",
"scale",
"sku",
"company",
"country",
)
list_filter = (
'rolling_class__type__category', 'rolling_class__type',
'scale', 'manufacturer')
"rolling_class__type__category",
"rolling_class__type",
"scale",
"manufacturer",
)
search_fields = list_display
fieldsets = (
(None, {
'fields': ('rolling_class',
'road_number',
'manufacturer',
'scale',
'sku',
'decoder',
'address',
'era',
'production_year',
'purchase_date',
'notes',
'tags')
}),
('Audit', {
'classes': ('collapse',),
'fields': ('creation_time', 'updated_time',)
}),
(
None,
{
"fields": (
"rolling_class",
"road_number",
"manufacturer",
"scale",
"sku",
"decoder",
"address",
"era",
"production_year",
"purchase_date",
"notes",
"tags",
)
},
),
(
"Audit",
{
"classes": ("collapse",),
"fields": (
"creation_time",
"updated_time",
),
},
),
)