.
This commit is contained in:
+23
-20
@@ -30,7 +30,7 @@ from .forms import (
|
||||
SeriesImageFormSet,
|
||||
SeriesFormSet,
|
||||
ExaminationForm,
|
||||
SeriesFindingsForm
|
||||
SeriesFindingForm,
|
||||
)
|
||||
from .models import (
|
||||
Case,
|
||||
@@ -38,8 +38,8 @@ from .models import (
|
||||
Examination,
|
||||
Finding,
|
||||
Subspecialty,
|
||||
SeriesFindings,
|
||||
SeriesImage
|
||||
SeriesFinding,
|
||||
SeriesImage,
|
||||
)
|
||||
from .tables import AtlasTable, SeriesTable
|
||||
from .filters import AtlasFilter, SeriesFilter
|
||||
@@ -117,11 +117,14 @@ def series_detail(request, pk):
|
||||
|
||||
# if request.user not in atlas.author.all():
|
||||
# raise PermissionDenied
|
||||
series_finding_form = SeriesFindingsForm(series_id=series.id)
|
||||
|
||||
series_finding_form = SeriesFindingForm(series_id=series.id)
|
||||
|
||||
# logging.debug(atlas.subspecialty.first().name.all())
|
||||
return render(request, "atlas/series.html", {"series": series, "series_finding_form": series_finding_form})
|
||||
return render(
|
||||
request,
|
||||
"atlas/series.html",
|
||||
{"series": series, "series_finding_form": series_finding_form},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@@ -516,28 +519,28 @@ class SeriesImagesZipView(SuperuserRequiredMixin, BaseZipView):
|
||||
|
||||
return [i.image.file for i in series.images.all()]
|
||||
|
||||
|
||||
def create_series_findings(request):
|
||||
#posts = Post.objects.all()
|
||||
# posts = Post.objects.all()
|
||||
response_data = {}
|
||||
|
||||
if request.POST.get('action') == 'post':
|
||||
series_id = request.POST.get('series')
|
||||
findings_ids = json.loads(request.POST.get('findings'))
|
||||
description = request.POST.get('description')
|
||||
annotation_json = json.loads(request.POST.get('annotation_json'))
|
||||
if request.POST.get("action") == "post":
|
||||
series_id = request.POST.get("series")
|
||||
findings_ids = json.loads(request.POST.get("findings"))
|
||||
description = request.POST.get("description")
|
||||
annotation_json = json.loads(request.POST.get("annotation_json"))
|
||||
|
||||
series = Series.objects.get(pk=series_id)
|
||||
findings = Finding.objects.filter(pk__in=findings_ids)
|
||||
|
||||
|
||||
sf = SeriesFindings.objects.create(
|
||||
series = series,
|
||||
description = description,
|
||||
annotation_json = annotation_json,
|
||||
)
|
||||
sf = SeriesFinding.objects.create(
|
||||
series=series,
|
||||
description=description,
|
||||
annotation_json=annotation_json,
|
||||
)
|
||||
sf.findings.set(findings)
|
||||
sf.save()
|
||||
return JsonResponse({"success":True})
|
||||
return JsonResponse({"success": True})
|
||||
|
||||
return JsonResponse({"success": False})
|
||||
return render(request, 'create_post.html', {'posts':posts})
|
||||
return render(request, "create_post.html", {"posts": posts})
|
||||
|
||||
Reference in New Issue
Block a user