From: Guillaume Pellerin Date: Thu, 25 Jan 2018 23:01:26 +0000 (+0100) Subject: Re-use post_save X-Git-Tag: 1.2~10^2~12 X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=8ff2293b1eea9dd1b1b67cc0cb292766c966f156;p=teleforma.git Re-use post_save --- diff --git a/teleforma/exam/models.py b/teleforma/exam/models.py index dd8a1820..4cb8cf0d 100644 --- a/teleforma/exam/models.py +++ b/teleforma/exam/models.py @@ -351,10 +351,6 @@ class Script(BaseResource): self.mark() if self.status == 0 and self.reject_reason: self.reject() - if not self.url: - self.uuid_link() - if not self.corrector: - self.submit() super(Script, self).save(*args, **kwargs) def update(self, *args, **kwargs): @@ -493,13 +489,14 @@ def set_file_properties(sender, instance, **kwargs): instance.uuid_link() if not instance.corrector: instance.submit() - if hasattr(instance, 'image'): - if not instance.image: - path = cache_path + os.sep + instance.uuid + '.jpg' - command = 'convert ' + instance.file.path + ' ' + path - os.system(command) - instance.image = path + super(sender, instance).save() + # if hasattr(instance, 'image'): + # if not instance.image: + # path = cache_path + os.sep + instance.uuid + '.jpg' + # command = 'convert ' + instance.file.path + ' ' + path + # os.system(command) + # instance.image = path -# post_save.connect(set_file_properties, sender=Script, dispatch_uid="script_post_save") -# post_save.connect(set_file_properties, sender=ScriptPage, dispatch_uid="scriptpage_post_save") +post_save.connect(set_file_properties, sender=Script, dispatch_uid="script_post_save") +post_save.connect(set_file_properties, sender=ScriptPage, dispatch_uid="scriptpage_post_save")