mirror of
https://github.com/daniviga/django-ram.git
synced 2025-08-04 21:27:49 +02:00
Speedup inlines using autocomplete field and add more previews (#38)
This commit is contained in:
@@ -8,7 +8,8 @@ class ConsistItemInline(SortableInlineAdminMixin, admin.TabularInline):
|
||||
model = ConsistItem
|
||||
min_num = 1
|
||||
extra = 0
|
||||
readonly_fields = ("address", "type", "company", "era")
|
||||
autocomplete_fields = ("rolling_stock",)
|
||||
readonly_fields = ("preview", "address", "type", "company", "era")
|
||||
|
||||
|
||||
@admin.register(Consist)
|
||||
|
@@ -60,6 +60,9 @@ class ConsistItem(models.Model):
|
||||
def __str__(self):
|
||||
return "{0}".format(self.rolling_stock)
|
||||
|
||||
def preview(self):
|
||||
return self.rolling_stock.image.first().image_thumbnail(100)
|
||||
|
||||
def type(self):
|
||||
return self.rolling_stock.rolling_class.type
|
||||
|
||||
|
Reference in New Issue
Block a user