mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	update document admin
This commit is contained in:
		| @@ -59,16 +59,19 @@ class DocumentAdmin(admin.ModelAdmin): | |||||||
|     list_display_links = ("title",) |     list_display_links = ("title",) | ||||||
|  |  | ||||||
|     list_display = ( |     list_display = ( | ||||||
|         "correspondent", |  | ||||||
|         "title", |  | ||||||
|         "tags_", |  | ||||||
|         "created", |         "created", | ||||||
|  |         "added", | ||||||
|  |         "archive_serial_number", | ||||||
|  |         "title", | ||||||
|  |         "mime_type", | ||||||
|  |         "filename", | ||||||
|  |         "archive_filename" | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|     list_filter = ( |     list_filter = ( | ||||||
|         "document_type", |         ("mime_type"), | ||||||
|         "tags", |         ("archive_serial_number", admin.EmptyFieldListFilter), | ||||||
|         "correspondent" |         ("archive_filename", admin.EmptyFieldListFilter), | ||||||
|     ) |     ) | ||||||
|  |  | ||||||
|     filter_horizontal = ("tags",) |     filter_horizontal = ("tags",) | ||||||
| @@ -99,26 +102,6 @@ class DocumentAdmin(admin.ModelAdmin): | |||||||
|         index.add_or_update_document(obj) |         index.add_or_update_document(obj) | ||||||
|         super(DocumentAdmin, self).save_model(request, obj, form, change) |         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): | class RuleInline(admin.TabularInline): | ||||||
|     model = SavedViewFilterRule |     model = SavedViewFilterRule | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 jonaswinkler
					jonaswinkler