Fix typo in prior_cases reference and streamline relationship validation in collection_case_priors
This commit is contained in:
+1
-1
@@ -1240,7 +1240,7 @@ class CaseDetail(models.Model):
|
|||||||
case_series_images = self.case.get_series_images_nested(as_json=False)
|
case_series_images = self.case.get_series_images_nested(as_json=False)
|
||||||
|
|
||||||
if include_priors:
|
if include_priors:
|
||||||
for prior in self.case.prior_cases.all():
|
for prior in self.case.prior_case.all():
|
||||||
case_series_images.extend(prior.get_series_images_nested(as_json=False))
|
case_series_images.extend(prior.get_series_images_nested(as_json=False))
|
||||||
|
|
||||||
return case_series_images
|
return case_series_images
|
||||||
|
|||||||
+4
-4
@@ -2159,16 +2159,16 @@ def collection_case_priors(request, exam_id, case_id):
|
|||||||
p.delete()
|
p.delete()
|
||||||
return HttpResponse(f"Case removed")
|
return HttpResponse(f"Case removed")
|
||||||
elif "prior_case_id" in request.POST:
|
elif "prior_case_id" in request.POST:
|
||||||
|
if not request.POST["relation"]:
|
||||||
|
return HttpResponse(
|
||||||
|
"You need to enter text to describe the relationship between the cases"
|
||||||
|
)
|
||||||
prior_case = Case.objects.get(pk=request.POST["prior_case_id"])
|
prior_case = Case.objects.get(pk=request.POST["prior_case_id"])
|
||||||
p, created = CasePrior.objects.get_or_create(
|
p, created = CasePrior.objects.get_or_create(
|
||||||
case_detail=case_detail, prior_case=prior_case
|
case_detail=case_detail, prior_case=prior_case
|
||||||
)
|
)
|
||||||
p.relation_text = request.POST["relation"]
|
p.relation_text = request.POST["relation"]
|
||||||
|
|
||||||
if not p.relation_text:
|
|
||||||
return HttpResponse(
|
|
||||||
"You need to enter text to describe the relationship between the cases"
|
|
||||||
)
|
|
||||||
p.prior_visibility = request.POST["prior_visibility"]
|
p.prior_visibility = request.POST["prior_visibility"]
|
||||||
|
|
||||||
p.save()
|
p.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user