Things back in admin
This commit is contained in:
@@ -28,15 +28,6 @@ class ThingTypeAdmin(DjangoMpttAdmin):
|
|||||||
search_fields = ('name',)
|
search_fields = ('name',)
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Thing)
|
|
||||||
class ThingAdmin(admin.ModelAdmin):
|
|
||||||
"""Admin configuration for Thing model."""
|
|
||||||
|
|
||||||
list_display = ('name', 'thing_type', 'box')
|
|
||||||
list_filter = ('thing_type', 'box')
|
|
||||||
search_fields = ('name', 'description')
|
|
||||||
|
|
||||||
|
|
||||||
class ThingFileInline(admin.TabularInline):
|
class ThingFileInline(admin.TabularInline):
|
||||||
"""Inline admin for Thing files."""
|
"""Inline admin for Thing files."""
|
||||||
|
|
||||||
@@ -53,8 +44,8 @@ class ThingLinkInline(admin.TabularInline):
|
|||||||
fields = ('title', 'url')
|
fields = ('title', 'url')
|
||||||
|
|
||||||
|
|
||||||
class ThingAdminWithFiles(admin.ModelAdmin):
|
class ThingAdmin(admin.ModelAdmin):
|
||||||
"""Admin configuration for Thing model with files and links."""
|
"""Admin configuration for Thing model."""
|
||||||
|
|
||||||
list_display = ('name', 'thing_type', 'box')
|
list_display = ('name', 'thing_type', 'box')
|
||||||
list_filter = ('thing_type', 'box')
|
list_filter = ('thing_type', 'box')
|
||||||
@@ -62,5 +53,22 @@ class ThingAdminWithFiles(admin.ModelAdmin):
|
|||||||
inlines = [ThingFileInline, ThingLinkInline]
|
inlines = [ThingFileInline, ThingLinkInline]
|
||||||
|
|
||||||
|
|
||||||
admin.site.unregister(Thing)
|
admin.site.register(Thing, ThingAdmin)
|
||||||
admin.register(Thing, ThingAdminWithFiles)
|
|
||||||
|
|
||||||
|
@admin.register(ThingFile)
|
||||||
|
class ThingFileAdmin(admin.ModelAdmin):
|
||||||
|
"""Admin configuration for ThingFile model."""
|
||||||
|
|
||||||
|
list_display = ('thing', 'title', 'uploaded_at')
|
||||||
|
list_filter = ('thing',)
|
||||||
|
search_fields = ('title',)
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(ThingLink)
|
||||||
|
class ThingLinkAdmin(admin.ModelAdmin):
|
||||||
|
"""Admin configuration for ThingLink model."""
|
||||||
|
|
||||||
|
list_display = ('thing', 'title', 'url', 'uploaded_at')
|
||||||
|
list_filter = ('thing',)
|
||||||
|
search_fields = ('title', 'url')
|
||||||
|
|||||||
@@ -76,7 +76,7 @@
|
|||||||
<i class="fas fa-align-left"></i> Description
|
<i class="fas fa-align-left"></i> Description
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: 16px; color: #555; line-height: 1.6; white-space: pre-wrap;">
|
<div style="font-size: 16px; color: #555; line-height: 1.6; white-space: pre-wrap;">
|
||||||
{{ thing.description }}
|
{% spaceless %}{{ thing.description }}{% endspaceless %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user