def delete(self, *args, **kwargs):
directory = self.directory
# Just doing a plain delete will collect all related objects in memory
# before deleting: translation projects, stores, units, quality checks,
# suggestions, and submissions.
# This can easily take down a process. If we do a translation project
# at a time and force garbage collection, things stay much more
# managable.
import gc
gc.collect()
for tp in self.translationproject_set.iterator():
tp.delete()
gc.collect()
super(Project, self).delete(*args, **kwargs)
directory.delete()
评论列表
文章目录