mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-20 01:45:58 -06:00
Even simpler
This commit is contained in:
@@ -183,21 +183,20 @@ def modify_custom_fields(
|
|||||||
reflect_doclinks(doc, custom_field, value)
|
reflect_doclinks(doc, custom_field, value)
|
||||||
|
|
||||||
# For doc link fields that are being removed, remove symmetrical links
|
# For doc link fields that are being removed, remove symmetrical links
|
||||||
for doclink_field in CustomField.objects.filter(
|
for doclink_being_removed_instance in CustomFieldInstance.objects.filter(
|
||||||
id__in=remove_custom_fields,
|
document_id__in=affected_docs,
|
||||||
data_type=CustomField.FieldDataType.DOCUMENTLINK,
|
field__id__in=remove_custom_fields,
|
||||||
).distinct():
|
field__data_type=CustomField.FieldDataType.DOCUMENTLINK,
|
||||||
for target_doc_instance in CustomFieldInstance.objects.filter(
|
value_document_ids__isnull=False,
|
||||||
document_id__in=affected_docs,
|
):
|
||||||
field=doclink_field,
|
for target_doc_id in doclink_being_removed_instance.value:
|
||||||
value_document_ids__isnull=False,
|
remove_doclink(
|
||||||
):
|
document=Document.objects.get(
|
||||||
for target_doc_id in target_doc_instance.value:
|
id=doclink_being_removed_instance.document.id,
|
||||||
remove_doclink(
|
),
|
||||||
document=Document.objects.get(id=target_doc_instance.document.id),
|
field=doclink_being_removed_instance.field,
|
||||||
field=doclink_field,
|
target_doc_id=target_doc_id,
|
||||||
target_doc_id=target_doc_id,
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# Finally, remove the custom fields
|
# Finally, remove the custom fields
|
||||||
CustomFieldInstance.objects.filter(
|
CustomFieldInstance.objects.filter(
|
||||||
|
|||||||
Reference in New Issue
Block a user