diff --git a/api/models/indiening.py b/api/models/indiening.py index 324a86df..3d1dc624 100644 --- a/api/models/indiening.py +++ b/api/models/indiening.py @@ -82,10 +82,12 @@ def save(self, *args, **kwargs): ) default_storage.save(new_path, ContentFile(old_file.read())) self.bestand.name = new_path + super(Indiening, self).save(*args, **kwargs) + old_file.storage.delete(old_file.name) + else: + super(Indiening, self).save(*args, **kwargs) - super(Indiening, self).save(*args, **kwargs) - - + def run_tests_async(instance): """ Voert tests uit op een asynchrone manier en werkt de status en het resultaat van de indiening bij.