Improve admin interfaces.

This commit is contained in:
Roberto Rosario
2015-09-08 18:13:22 -04:00
parent f21ee34a94
commit 02353927db
18 changed files with 139 additions and 67 deletions

View File

@@ -12,15 +12,15 @@ class IndexTemplateNodeInline(admin.StackedInline):
model = IndexTemplateNode
@admin.register(Index)
class IndexAdmin(admin.ModelAdmin):
filter_horizontal = ('document_types',)
inlines = [IndexTemplateNodeInline]
inlines = (IndexTemplateNodeInline,)
list_display = ('label', 'enabled', 'get_document_types')
def get_document_types(self, instance):
return ', '.join(['"{0}"'.format(document_type) for document_type in instance.document_types.all()]) or _('None')
return ', '.join(
['"{0}"'.format(document_type) for document_type in instance.document_types.all()]
) or _('None')
get_document_types.short_description = _('Document types')
admin.site.register(Index, IndexAdmin)