mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
codestyle
This commit is contained in:
parent
f0ad92e542
commit
80b47fa287
@ -8,11 +8,12 @@ def set_correspondent(doc_ids, correspondent):
|
||||
if correspondent:
|
||||
correspondent = Correspondent.objects.get(id=correspondent)
|
||||
|
||||
qs = Document.objects.filter(Q(id__in=doc_ids) & ~Q(correspondent=correspondent))
|
||||
qs = Document.objects.filter(
|
||||
Q(id__in=doc_ids) & ~Q(correspondent=correspondent))
|
||||
affected_docs = [doc.id for doc in qs]
|
||||
qs.update(correspondent=correspondent)
|
||||
|
||||
async_task("documents.tasks.bulk_rename_files", affected_docs)
|
||||
async_task("documents.tasks.bulk_rename_files", document_ids=affected_docs)
|
||||
|
||||
return "OK"
|
||||
|
||||
@ -21,11 +22,12 @@ def set_document_type(doc_ids, document_type):
|
||||
if document_type:
|
||||
document_type = DocumentType.objects.get(id=document_type)
|
||||
|
||||
qs = Document.objects.filter(Q(id__in=doc_ids) & ~Q(document_type=document_type))
|
||||
qs = Document.objects.filter(
|
||||
Q(id__in=doc_ids) & ~Q(document_type=document_type))
|
||||
affected_docs = [doc.id for doc in qs]
|
||||
qs.update(document_type=document_type)
|
||||
|
||||
async_task("documents.tasks.bulk_rename_files", affected_docs)
|
||||
async_task("documents.tasks.bulk_rename_files", document_ids=affected_docs)
|
||||
|
||||
return "OK"
|
||||
|
||||
@ -38,10 +40,11 @@ def add_tag(doc_ids, tag):
|
||||
DocumentTagRelationship = Document.tags.through
|
||||
|
||||
DocumentTagRelationship.objects.bulk_create([
|
||||
DocumentTagRelationship(document_id=doc, tag_id=tag) for doc in affected_docs
|
||||
DocumentTagRelationship(
|
||||
document_id=doc, tag_id=tag) for doc in affected_docs
|
||||
])
|
||||
|
||||
async_task("documents.tasks.bulk_rename_files", affected_docs)
|
||||
async_task("documents.tasks.bulk_rename_files", document_ids=affected_docs)
|
||||
|
||||
return "OK"
|
||||
|
||||
@ -58,7 +61,7 @@ def remove_tag(doc_ids, tag):
|
||||
Q(tag_id=tag)
|
||||
).delete()
|
||||
|
||||
async_task("documents.tasks.bulk_rename_files", affected_docs)
|
||||
async_task("documents.tasks.bulk_rename_files", document_ids=affected_docs)
|
||||
|
||||
return "OK"
|
||||
|
||||
|
@ -90,7 +90,7 @@ def sanity_check():
|
||||
return "No issues detected."
|
||||
|
||||
|
||||
def bulk_rename_files(ids):
|
||||
qs = Document.objects.filter(id__in=ids)
|
||||
def bulk_rename_files(document_ids):
|
||||
qs = Document.objects.filter(id__in=document_ids)
|
||||
for doc in qs:
|
||||
post_save.send(Document, instance=doc, created=False)
|
||||
|
Loading…
x
Reference in New Issue
Block a user