list_display_links = ("title",)
list_display = (
- "correspondent",
- "title",
- "tags_",
"created",
+ "added",
+ "archive_serial_number",
+ "title",
+ "mime_type",
+ "filename",
+ "archive_filename"
)
list_filter = (
- "document_type",
- "tags",
- "correspondent"
+ ("mime_type"),
+ ("archive_serial_number", admin.EmptyFieldListFilter),
+ ("archive_filename", admin.EmptyFieldListFilter),
)
filter_horizontal = ("tags",)
index.add_or_update_document(obj)
super(DocumentAdmin, self).save_model(request, obj, form, change)
- @mark_safe
- def tags_(self, obj):
- r = ""
- for tag in obj.tags.all():
- r += self._html_tag(
- "span",
- tag.name + ", "
- )
- return r
-
- @staticmethod
- def _html_tag(kind, inside=None, **kwargs):
- attributes = format_html_join(' ', '{}="{}"', kwargs.items())
-
- if inside is not None:
- return format_html("<{kind} {attributes}>{inside}</{kind}>",
- kind=kind, attributes=attributes, inside=inside)
-
- return format_html("<{} {}/>", kind, attributes)
-
class RuleInline(admin.TabularInline):
model = SavedViewFilterRule