fix image hashes (possible)
This commit is contained in:
+9
-6
@@ -205,15 +205,18 @@ class SeriesImageBase(models.Model):
|
||||
def save(self, *args, **kwargs):
|
||||
"""Override save method to add image hash"""
|
||||
if self.image:
|
||||
image_hash, is_dicom = get_image_hash(self.image)
|
||||
|
||||
self.is_dicom = is_dicom
|
||||
self.image_md5_hash = image_hash
|
||||
if not self.image_md5_hash:
|
||||
image_hash, is_dicom = get_image_hash(self.image)
|
||||
|
||||
self.is_dicom = is_dicom
|
||||
self.image_md5_hash = image_hash
|
||||
|
||||
# Hack for tests
|
||||
if image_hash != "12345ABCD":
|
||||
super().save(*args, **kwargs) # Call the "real" save() method.
|
||||
# Hack for tests
|
||||
if image_hash != "12345ABCD":
|
||||
super().save(*args, **kwargs) # Call the "real" save() method.
|
||||
|
||||
super().save(*args, **kwargs) # Call the "real" save() method.
|
||||
|
||||
class SeriesBase(models.Model):
|
||||
info = models.TextField(
|
||||
|
||||
Reference in New Issue
Block a user