def set_file_properties(sender, instance, **kwargs):
if instance.file:
+ trig_save = False
if not instance.mime_type:
instance.mime_type = mimetype_file(instance.file.path)
+ trig_save = True
if not instance.sha1:
instance.sha1 = sha1sum_file(instance.file.path)
+ trig_save = True
if not instance.url:
instance.uuid_link()
+ trig_save = True
if not instance.corrector:
instance.submit()
- super(sender, instance).save()
+ trig_save = True
+ if trig_save:
+ super(sender, instance).save()
+
# if hasattr(instance, 'image'):
# if not instance.image:
# path = cache_path + os.sep + instance.uuid + '.jpg'