This commit is contained in:
Ross
2021-03-01 08:13:59 +00:00
parent 307d83c015
commit dd33a728de
9 changed files with 43 additions and 14 deletions
+9 -5
View File
@@ -119,7 +119,7 @@ class Long(models.Model):
)
def get_absolute_url(self):
return reverse("longs:long_detail", kwargs={"pk": self.pk})
return reverse("longs:question_detail", kwargs={"pk": self.pk})
def get_authors(self):
"""Returns a comma seperated text list of authors"""
@@ -324,7 +324,7 @@ class LongSeries(models.Model):
def order_by_dicom_location(self):
def order_by_dicom(self, field="SliceLocation"):
images = self.images.all()
files = []
@@ -339,7 +339,7 @@ class LongSeries(models.Model):
map = {}
skipcount = 0
for i, f in files:
if hasattr(f, 'SliceLocation'):
if hasattr(f, field):
slices.append(f)
map[f.SliceLocation] = i
else:
@@ -348,7 +348,11 @@ class LongSeries(models.Model):
print("skipped, no SliceLocation: {}".format(skipcount))
# ensure they are in the correct order
slices = sorted(slices, key=lambda s: s.SliceLocation)
if field == "SliceLocation":
slices = sorted(slices, key=lambda s: s.SliceLocation)
elif field == "InstanceNumber":
slices = sorted(slices, key=lambda s: s.InstanceNumber)
#print(slices)
n = 1
@@ -390,7 +394,7 @@ class Note(models.Model):
def get_absolute_url(self):
self.pk = self.long_id
return reverse("longs:long_detail", kwargs={"pk": self.pk})
return reverse("longs:question_detail", kwargs={"pk": self.pk})
def __str__(self):
return "{} [{}] {}".format(self.long, self.author, self.created_on)