.
This commit is contained in:
+9
-2
@@ -188,7 +188,8 @@ class FindingTable(tables.Table):
|
||||
)
|
||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||
|
||||
synonym = tables.ManyToManyColumn(verbose_name="Synonyms")
|
||||
#synonym = tables.ManyToManyColumn(verbose_name="Synonyms")
|
||||
synonym = tables.Column(empty_values=())
|
||||
parent = tables.ManyToManyColumn(verbose_name="Parents")
|
||||
|
||||
class Meta:
|
||||
@@ -197,6 +198,8 @@ class FindingTable(tables.Table):
|
||||
fields = ("name", "primary")
|
||||
sequence = ("name",)
|
||||
|
||||
def render_synonym(self, value, record):
|
||||
return format_html(record.get_synonym_link())
|
||||
|
||||
class StructureTable(tables.Table):
|
||||
name = tables.Column(
|
||||
@@ -211,7 +214,8 @@ class StructureTable(tables.Table):
|
||||
)
|
||||
selection = tables.CheckBoxColumn(accessor="pk", orderable=False)
|
||||
|
||||
synonym = tables.ManyToManyColumn(verbose_name="Synonyms")
|
||||
#synonym = tables.ManyToManyColumn(verbose_name="Synonyms")
|
||||
synonym = tables.Column(empty_values=())
|
||||
parent = tables.ManyToManyColumn(verbose_name="Parents")
|
||||
|
||||
class Meta:
|
||||
@@ -219,3 +223,6 @@ class StructureTable(tables.Table):
|
||||
template_name = "django_tables2/bootstrap4.html"
|
||||
fields = ("name", "primary")
|
||||
sequence = ("name",)
|
||||
|
||||
def render_synonym(self, value, record):
|
||||
return format_html(record.get_synonym_link())
|
||||
+32
-8
@@ -12,23 +12,47 @@ urlpatterns = [
|
||||
path("case/", views.CaseView.as_view(), name="case_view"),
|
||||
path("condition/", views.ConditionView.as_view(), name="condition_view"),
|
||||
path("condition/<int:pk>", views.condition_detail, name="condition_detail"),
|
||||
path("condition/<int:pk>/delete", views.ConditionDelete.as_view(), name="condition_delete"),
|
||||
path("condition/<int:pk>/update", views.ConditionUpdate.as_view(), name="condition_update"),
|
||||
path(
|
||||
"condition/<int:pk>/delete",
|
||||
views.ConditionDelete.as_view(),
|
||||
name="condition_delete",
|
||||
),
|
||||
path(
|
||||
"condition/<int:pk>/update",
|
||||
views.ConditionUpdate.as_view(),
|
||||
name="condition_update",
|
||||
),
|
||||
path("condition/create", views.ConditionCreate.as_view(), name="condition_create"),
|
||||
path("finding/", views.FindingView.as_view(), name="finding_view"),
|
||||
path("finding/<int:pk>", views.finding_detail, name="finding_detail"),
|
||||
path("finding/<int:pk>/delete", views.FindingDelete.as_view(), name="finding_delete"),
|
||||
path("finding/<int:pk>/update", views.FindingUpdate.as_view(), name="finding_update"),
|
||||
path(
|
||||
"finding/<int:pk>/delete", views.FindingDelete.as_view(), name="finding_delete"
|
||||
),
|
||||
path(
|
||||
"finding/<int:pk>/update", views.FindingUpdate.as_view(), name="finding_update"
|
||||
),
|
||||
path("finding/create", views.FindingCreate.as_view(), name="finding_create"),
|
||||
path("structure/", views.StructureView.as_view(), name="structure_view"),
|
||||
path("structure/<int:pk>", views.structure_detail, name="structure_detail"),
|
||||
path("structure/<int:pk>/delete", views.StructureDelete.as_view(), name="structure_delete"),
|
||||
path("structure/<int:pk>/update", views.StructureUpdate.as_view(), name="structure_update"),
|
||||
path(
|
||||
"structure/<int:pk>/delete",
|
||||
views.StructureDelete.as_view(),
|
||||
name="structure_delete",
|
||||
),
|
||||
path(
|
||||
"structure/<int:pk>/update",
|
||||
views.StructureUpdate.as_view(),
|
||||
name="structure_update",
|
||||
),
|
||||
path("structure/create", views.StructureCreate.as_view(), name="structure_create"),
|
||||
path("series/<int:pk>", views.series_detail, name="series_detail"),
|
||||
path("series/", views.SeriesView.as_view(), name="series_view"),
|
||||
path("series/<int:pk>", views.series_detail, name="series_detail"),
|
||||
path("series/<int:pk>/<int:finding_pk>", views.series_detail, name="series_edit_finding"),
|
||||
path(
|
||||
"series/<int:pk>/<int:finding_pk>",
|
||||
views.series_detail,
|
||||
name="series_edit_finding",
|
||||
),
|
||||
path(
|
||||
"series/<int:pk>/order_dicom",
|
||||
views.series_order_dicom,
|
||||
@@ -66,7 +90,7 @@ urlpatterns = [
|
||||
# path("verified/", views.verified, name="verified"),
|
||||
# path("all_questions/", views.all_questions, name="all_questions"),
|
||||
path("case/<int:pk>/scrap", views.atlas_scrap, name="case_scrap"),
|
||||
path("case/<int:pk>/delete", views.AtlasDelete.as_view(), name="case_delete"),
|
||||
path("case/<int:pk>/delete", views.CaseDelete.as_view(), name="case_delete"),
|
||||
path("case/create/", views.AtlasCreate.as_view(), name="create"),
|
||||
path("series/create", views.SeriesCreate.as_view(), name="series_create"),
|
||||
path(
|
||||
|
||||
+29
-6
@@ -49,7 +49,13 @@ from .models import (
|
||||
SeriesImage,
|
||||
)
|
||||
from .tables import CaseTable, ConditionTable, FindingTable, SeriesTable, StructureTable
|
||||
from .filters import AtlasFilter, ConditionFilter, FindingFilter, SeriesFilter, StructureFilter
|
||||
from .filters import (
|
||||
AtlasFilter,
|
||||
ConditionFilter,
|
||||
FindingFilter,
|
||||
SeriesFilter,
|
||||
StructureFilter,
|
||||
)
|
||||
|
||||
from django_tables2 import SingleTableView, SingleTableMixin
|
||||
from django_filters.views import FilterView
|
||||
@@ -141,6 +147,7 @@ def series_detail(request, pk, finding_pk=None):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_atlas_checker
|
||||
def condition_detail(request, pk):
|
||||
@@ -155,6 +162,7 @@ def condition_detail(request, pk):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_atlas_checker
|
||||
def structure_detail(request, pk):
|
||||
@@ -169,6 +177,7 @@ def structure_detail(request, pk):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_atlas_checker
|
||||
def finding_detail(request, pk):
|
||||
@@ -183,6 +192,7 @@ def finding_detail(request, pk):
|
||||
},
|
||||
)
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_atlas_checker
|
||||
def author_detail(request, pk):
|
||||
@@ -204,9 +214,10 @@ def author_list(request):
|
||||
return render(request, "atlas/author_list.html", {"authors": authors})
|
||||
|
||||
|
||||
class AtlasDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
class CaseDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
model = Case
|
||||
success_url = reverse_lazy("atlas:case_view")
|
||||
template_name = "confirm_delete.html"
|
||||
|
||||
|
||||
class SeriesFindingDelete(RevisionMixin, PermissionRequiredMixin, DeleteView):
|
||||
@@ -226,21 +237,25 @@ class SeriesDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
template_name = "confirm_delete.html"
|
||||
success_url = reverse_lazy("atlas:series_view")
|
||||
|
||||
|
||||
class ConditionDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
model = Condition
|
||||
template_name = "confirm_delete.html"
|
||||
success_url = reverse_lazy("atlas:condition_view")
|
||||
|
||||
|
||||
class FindingDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
model = Finding
|
||||
template_name = "confirm_delete.html"
|
||||
success_url = reverse_lazy("atlas:finding_view")
|
||||
|
||||
|
||||
class StructureDelete(RevisionMixin, AuthorOrCheckerRequiredMixin, DeleteView):
|
||||
model = Structure
|
||||
template_name = "confirm_delete.html"
|
||||
success_url = reverse_lazy("atlas:structure_view")
|
||||
|
||||
|
||||
@login_required
|
||||
@user_is_author_or_atlas_checker
|
||||
def case_clone(request, pk):
|
||||
@@ -366,30 +381,36 @@ class ConditionUpdate(
|
||||
model = Condition
|
||||
form_class = ConditionForm
|
||||
|
||||
|
||||
class ConditionCreate(RevisionMixin, LoginRequiredMixin, CreateView):
|
||||
model = Condition
|
||||
form_class = ConditionForm
|
||||
|
||||
|
||||
class FindingUpdate(
|
||||
RevisionMixin, LoginRequiredMixin, AuthorOrCheckerRequiredMixin, UpdateView
|
||||
):
|
||||
model = Finding
|
||||
form_class = FindingForm
|
||||
|
||||
|
||||
class FindingCreate(RevisionMixin, LoginRequiredMixin, CreateView):
|
||||
model = Finding
|
||||
form_class = FindingForm
|
||||
|
||||
|
||||
class StructureUpdate(
|
||||
RevisionMixin, LoginRequiredMixin, AuthorOrCheckerRequiredMixin, UpdateView
|
||||
):
|
||||
model = Structure
|
||||
form_class = StructureForm
|
||||
|
||||
|
||||
class StructureCreate(RevisionMixin, LoginRequiredMixin, CreateView):
|
||||
model = Structure
|
||||
form_class = StructureForm
|
||||
|
||||
|
||||
class AtlasCreateBase(RevisionMixin, LoginRequiredMixin):
|
||||
model = Case
|
||||
form_class = CaseForm
|
||||
@@ -579,6 +600,7 @@ class SeriesView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
filterset_class = SeriesFilter
|
||||
|
||||
|
||||
class ConditionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Condition
|
||||
table_class = ConditionTable
|
||||
@@ -586,6 +608,7 @@ class ConditionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
filterset_class = ConditionFilter
|
||||
|
||||
|
||||
class StructureView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Structure
|
||||
table_class = StructureTable
|
||||
@@ -593,6 +616,7 @@ class StructureView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
|
||||
filterset_class = StructureFilter
|
||||
|
||||
|
||||
class FindingView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Finding
|
||||
table_class = FindingTable
|
||||
@@ -679,9 +703,9 @@ def create_series_findings(request):
|
||||
if series_finding_id > 0:
|
||||
sf = get_object_or_404(SeriesFinding, pk=series_finding_id)
|
||||
sf.series = series
|
||||
sf.description=description
|
||||
sf.annotation_json=annotation_json
|
||||
sf.viewport_json=viewport_json
|
||||
sf.description = description
|
||||
sf.annotation_json = annotation_json
|
||||
sf.viewport_json = viewport_json
|
||||
else:
|
||||
sf = SeriesFinding.objects.create(
|
||||
series=series,
|
||||
@@ -690,7 +714,6 @@ def create_series_findings(request):
|
||||
viewport_json=viewport_json,
|
||||
)
|
||||
|
||||
|
||||
sf.findings.set(findings)
|
||||
sf.structures.set(structures)
|
||||
sf.save()
|
||||
|
||||
Reference in New Issue
Block a user