extract a little more shared case /longs
This commit is contained in:
@@ -24,6 +24,7 @@ from django.contrib.auth.models import User
|
||||
|
||||
from django.db.models.signals import post_save
|
||||
from django.dispatch import receiver
|
||||
from helpers.images import pretty_print_dicom
|
||||
from rad.settings import REMOTE_URL
|
||||
from django.utils.html import format_html
|
||||
|
||||
@@ -115,6 +116,24 @@ class QuestionBase(models.Model):
|
||||
"""If this makes sense in the question/answer context override"""
|
||||
return None
|
||||
|
||||
class SeriesImageBase(models.Model):
|
||||
position = models.IntegerField(default=0)
|
||||
upload_filename = models.CharField(max_length=255, blank=True)
|
||||
series = models.ForeignKey(
|
||||
"Series", related_name="images", on_delete=models.SET_NULL, null=True
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ["position"]
|
||||
abstract = True
|
||||
|
||||
def get_dicom_info(self):
|
||||
try:
|
||||
info = pretty_print_dicom(pydicom.read_file(self.image))
|
||||
except pydicom.errors.InvalidDicomError:
|
||||
info = "File is not a dicom."
|
||||
return info
|
||||
|
||||
|
||||
class SeriesBase(models.Model):
|
||||
description = models.TextField(
|
||||
|
||||
Reference in New Issue
Block a user