mirror of
https://git.sdbs.cz/sdbs/pile.git
synced 2025-05-10 00:12:18 +00:00
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):
|
class DocumentAdmin(admin.ModelAdmin):
|
||||||
exclude = ('is_removed',)
|
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)
|
list_filter = ('tags', 'public', DocumentExternalListFilter)
|
||||||
search_fields = ('title', 'author', 'published')
|
search_fields = ('title', 'author', 'published')
|
||||||
actions = ('make_published', 'make_hidden')
|
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
|
@staticmethod
|
||||||
def filed_under(document: Document):
|
def filed_under(document: Document):
|
||||||
return ", ".join(tag.name for tag in document.tags.all())
|
return ", ".join(tag.name for tag in document.tags.all())
|
||||||
|
|
Loading…
Add table
Reference in a new issue