mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-08-14 00:26:21 +00:00
Format Python code with black
This commit is contained in:
@@ -1,39 +1,32 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Correspondent, Document, DocumentType, Tag, \
|
||||
SavedView, SavedViewFilterRule
|
||||
from .models import (
|
||||
Correspondent,
|
||||
Document,
|
||||
DocumentType,
|
||||
Tag,
|
||||
SavedView,
|
||||
SavedViewFilterRule,
|
||||
)
|
||||
|
||||
|
||||
class CorrespondentAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = (
|
||||
"name",
|
||||
"match",
|
||||
"matching_algorithm"
|
||||
)
|
||||
list_display = ("name", "match", "matching_algorithm")
|
||||
list_filter = ("matching_algorithm",)
|
||||
list_editable = ("match", "matching_algorithm")
|
||||
|
||||
|
||||
class TagAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = (
|
||||
"name",
|
||||
"color",
|
||||
"match",
|
||||
"matching_algorithm"
|
||||
)
|
||||
list_display = ("name", "color", "match", "matching_algorithm")
|
||||
list_filter = ("color", "matching_algorithm")
|
||||
list_editable = ("color", "match", "matching_algorithm")
|
||||
|
||||
|
||||
class DocumentTypeAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = (
|
||||
"name",
|
||||
"match",
|
||||
"matching_algorithm"
|
||||
)
|
||||
list_display = ("name", "match", "matching_algorithm")
|
||||
list_filter = ("matching_algorithm",)
|
||||
list_editable = ("match", "matching_algorithm")
|
||||
|
||||
@@ -49,18 +42,12 @@ class DocumentAdmin(admin.ModelAdmin):
|
||||
"filename",
|
||||
"checksum",
|
||||
"archive_filename",
|
||||
"archive_checksum"
|
||||
"archive_checksum",
|
||||
)
|
||||
|
||||
list_display_links = ("title",)
|
||||
|
||||
list_display = (
|
||||
"id",
|
||||
"title",
|
||||
"mime_type",
|
||||
"filename",
|
||||
"archive_filename"
|
||||
)
|
||||
list_display = ("id", "title", "mime_type", "filename", "archive_filename")
|
||||
|
||||
list_filter = (
|
||||
("mime_type"),
|
||||
@@ -79,6 +66,7 @@ class DocumentAdmin(admin.ModelAdmin):
|
||||
|
||||
def created_(self, obj):
|
||||
return obj.created.date().strftime("%Y-%m-%d")
|
||||
|
||||
created_.short_description = "Created"
|
||||
|
||||
def delete_queryset(self, request, queryset):
|
||||
@@ -92,11 +80,13 @@ class DocumentAdmin(admin.ModelAdmin):
|
||||
|
||||
def delete_model(self, request, obj):
|
||||
from documents import index
|
||||
|
||||
index.remove_document_from_index(obj)
|
||||
super(DocumentAdmin, self).delete_model(request, obj)
|
||||
|
||||
def save_model(self, request, obj, form, change):
|
||||
from documents import index
|
||||
|
||||
index.add_or_update_document(obj)
|
||||
super(DocumentAdmin, self).save_model(request, obj, form, change)
|
||||
|
||||
@@ -109,9 +99,7 @@ class SavedViewAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ("name", "user")
|
||||
|
||||
inlines = [
|
||||
RuleInline
|
||||
]
|
||||
inlines = [RuleInline]
|
||||
|
||||
|
||||
admin.site.register(Correspondent, CorrespondentAdmin)
|
||||
|
Reference in New Issue
Block a user