mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Prettied up the interface a little
This commit is contained in:
		| @@ -40,26 +40,21 @@ class TagAdmin(admin.ModelAdmin): | ||||
|  | ||||
| class DocumentAdmin(admin.ModelAdmin): | ||||
|  | ||||
|     class Media: | ||||
|         css = { | ||||
|             "all": ("paperless.css",) | ||||
|         } | ||||
|  | ||||
|     search_fields = ("sender__name", "title", "content") | ||||
|     list_display = ("created", "sender", "title", "tags_", "document") | ||||
|     list_filter = ("tags", "sender", MonthListFilter) | ||||
|     list_editable = ("sender", "title") | ||||
|     list_per_page = 25 | ||||
|  | ||||
|     def document(self, obj): | ||||
|         return '<a href="{}">' \ | ||||
|                  '<img src="{}" width="22" height="22" alt="{} icon">' \ | ||||
|                '</a>'.format( | ||||
|                     reverse("fetch", kwargs={"pk": obj.pk}), | ||||
|                     static("documents/img/application-pdf.png"), | ||||
|                     obj.file_type | ||||
|                 ) | ||||
|     document.allow_tags = True | ||||
|  | ||||
|     def tags_(self, obj): | ||||
|         r = "" | ||||
|         for tag in obj.tags.all(): | ||||
|             r += '<a style="padding: 0 0.5em; background-color: {}; color: #ffffff; border-radius: 0.2em; margin: 1px; display: inline-block;" href="{}">{}</a>'.format( | ||||
|             r += '<a class="tag" style="background-color: {};" href="{}">{}</a>'.format( | ||||
|                 tag.get_colour_display(), | ||||
|                 "{}?tags__id__exact={}".format( | ||||
|                     reverse("admin:documents_document_changelist"), | ||||
| @@ -70,6 +65,16 @@ class DocumentAdmin(admin.ModelAdmin): | ||||
|         return r | ||||
|     tags_.allow_tags = True | ||||
|  | ||||
|     def document(self, obj): | ||||
|         return '<a href="{}">' \ | ||||
|                  '<img src="{}" width="22" height="22" alt="{} icon">' \ | ||||
|                '</a>'.format( | ||||
|                     reverse("fetch", kwargs={"pk": obj.pk}), | ||||
|                     static("documents/img/{}.png".format(obj.file_type)), | ||||
|                     obj.file_type | ||||
|                 ) | ||||
|     document.allow_tags = True | ||||
|  | ||||
| admin.site.register(Sender) | ||||
| admin.site.register(Tag, TagAdmin) | ||||
| admin.site.register(Document, DocumentAdmin) | ||||
|   | ||||
										
											Binary file not shown.
										
									
								
							| Before Width: | Height: | Size: 3.8 KiB | 
							
								
								
									
										1
									
								
								src/documents/static/documents/img/gif.png
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								src/documents/static/documents/img/gif.png
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| image.png | ||||
							
								
								
									
										
											BIN
										
									
								
								src/documents/static/documents/img/image.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/documents/static/documents/img/image.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 30 KiB | 
							
								
								
									
										1
									
								
								src/documents/static/documents/img/jpg.png
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								src/documents/static/documents/img/jpg.png
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| image.png | ||||
| Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB | 
							
								
								
									
										1
									
								
								src/documents/static/documents/img/png.png
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								src/documents/static/documents/img/png.png
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| image.png | ||||
							
								
								
									
										1
									
								
								src/documents/static/documents/img/tiff.png
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								src/documents/static/documents/img/tiff.png
									
									
									
									
									
										Symbolic link
									
								
							| @@ -0,0 +1 @@ | ||||
| image.png | ||||
							
								
								
									
										12
									
								
								src/documents/static/paperless.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/documents/static/paperless.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| th.column-document, | ||||
| td.field-document { | ||||
|   text-align: center; | ||||
| } | ||||
|  | ||||
| td a.tag { | ||||
|   padding: 0 0.5em; | ||||
|   color: #ffffff; | ||||
|   border-radius: 0.2em; | ||||
|   margin: 1px; | ||||
|   display: inline-block; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Quinn
					Daniel Quinn