mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-11-28 00:09:09 -06:00
Do the clear in one operation
This commit is contained in:
@@ -547,12 +547,12 @@ def process_cf_select_update(custom_field: CustomField):
|
|||||||
for option in custom_field.extra_data.get("select_options", [])
|
for option in custom_field.extra_data.get("select_options", [])
|
||||||
}
|
}
|
||||||
|
|
||||||
for cf_instance in custom_field.fields.select_related("document").iterator():
|
# Clear select values that no longer exist
|
||||||
# Check if the current value is still a valid option
|
custom_field.fields.exclude(
|
||||||
if cf_instance.value not in select_options:
|
value_select__in=select_options.keys(),
|
||||||
cf_instance.value_select = None
|
).update(value_select=None)
|
||||||
cf_instance.save(update_fields=["value_select"])
|
|
||||||
|
|
||||||
|
for cf_instance in custom_field.fields.select_related("document").iterator():
|
||||||
# Update the filename and move files if necessary
|
# Update the filename and move files if necessary
|
||||||
update_filename_and_move_files(CustomFieldInstance, cf_instance)
|
update_filename_and_move_files(CustomFieldInstance, cf_instance)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user