Don't save Document in pre_delete handler (fixes #2889)
FileField.delete() will, by default, save() the model instance it is attached to. This is pointless if we're in the process of deleting the Document -- and since Document.save() calls Document.update_matches(), this scans all annotations every time a document is deleted.
This commit is contained in:
parent
7d99950942
commit
6e0049a20c
1 changed files with 1 additions and 1 deletions
|
@ -302,7 +302,7 @@ def delete_document(sender, **kwargs):
|
|||
for f in glob('%s/*' % folder):
|
||||
if f != t.file.path:
|
||||
os.unlink(f)
|
||||
t.file.delete()
|
||||
t.file.delete(save=False)
|
||||
pre_delete.connect(delete_document, sender=Document)
|
||||
|
||||
class ItemProperties(models.Model):
|
||||
|
|
Loading…
Reference in a new issue