INNER CODE UNIT · Python
MLSettings
center-for-threat-informed-defense/tram · src/tram/models.py:186
class MLSettings(models.Model):
"""Settings for Machine Learning models"""
def _delete_file(path):
# Deletes file from filesystem
if os.path.isfile(path):
os.remove(path)
@receiver(post_delete, sender=Document)
def delete_file_post_delete(sender, instance, *args, **kwargs):
if instance.docfile:
_delete_file(instance.docfile.path)