add "has file" column
This commit is contained in:
parent
e724748a5f
commit
757f30b53c
1 changed files with 6 additions and 1 deletions
|
@ -33,11 +33,16 @@ class DocumentExternalListFilter(admin.SimpleListFilter):
|
|||
|
||||
class DocumentAdmin(admin.ModelAdmin):
|
||||
exclude = ('is_removed',)
|
||||
list_display = ('title', 'author', 'published', 'public', 'filed_under')
|
||||
list_display = ('title', 'author', 'published', 'has_file', 'public', 'filed_under')
|
||||
list_filter = ('tags', 'public', DocumentExternalListFilter)
|
||||
search_fields = ('title', 'author', 'published')
|
||||
actions = ('make_published', 'make_hidden')
|
||||
|
||||
def has_file(self, document: Document):
|
||||
return document.file is not None and document.file != ''
|
||||
|
||||
has_file.boolean = True
|
||||
|
||||
@staticmethod
|
||||
def filed_under(document: Document):
|
||||
return ", ".join(tag.name for tag in document.tags.all())
|
||||
|
|
Loading…
Reference in a new issue