Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix various missing template variables #1062

Merged
merged 1 commit into from
Jan 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions isic/core/templates/core/image_detail/base.html
Original file line number Diff line number Diff line change
@@ -78,15 +78,15 @@
{% include 'core/image_detail/metadata_tab.html' %}
{% include 'core/image_detail/studies_tab.html' %}

{% if sections.patient_images %}
{% if 'patient_images' in sections %}
{% include 'core/image_detail/images_tab.html' with images=other_patient_images images_count=other_patient_images_count section_name='patient_images' %}
{% endif %}

{% if sections.lesion_images %}
{% if 'lesion_images' in sections %}
{% include 'core/image_detail/images_tab.html' with images=other_lesion_images images_count=other_lesion_images_count section_name='lesion_images' %}
{% endif %}

{% if sections.ingestion_details %}
{% if 'ingestion_details' in sections %}
{% include 'core/image_detail/ingestion_details_tab.html' %}
{% endif %}
</div>
6 changes: 1 addition & 5 deletions isic/core/templates/core/partials/nav_elements.html
Original file line number Diff line number Diff line change
@@ -4,11 +4,7 @@
<li tabindex="0">
<a>
Staff
{% if right_arrow %}
<svg class="fill-current" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z"/></svg>
{% else %}
<svg class="fill-current" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"/></svg>
{% endif %}
<svg class="fill-current" xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z"/></svg>
</a>
<ul class="p-2 bg-base-100 z-20">
<li><a href="{% url 'ingest-review' %}">Ingest Review</a></li>
4 changes: 2 additions & 2 deletions isic/core/tests/test_view_image_detail.py
Original file line number Diff line number Diff line change
@@ -74,8 +74,8 @@ def test_view_image_detail_public(client, detailed_image):
assert r.status_code == 200
assert set(r.context["sections"].keys()) == {"metadata", "studies"}

assert "unstructured_metadata" not in r.context
assert "metadata_versions" not in r.context
assert r.context["unstructured_metadata"] == {}
assert r.context["metadata_versions"] == []

assert "age" not in r.context["metadata"]

2 changes: 2 additions & 0 deletions isic/core/views/images.py
Original file line number Diff line number Diff line change
@@ -80,6 +80,8 @@ def image_detail(request, isic_id):
"other_lesion_images_count": other_lesion_images.count(),
"MAX_RELATED_SHOW_FIRST_N": MAX_RELATED_SHOW_FIRST_N,
"studies": studies,
"unstructured_metadata": {},
"metadata_versions": [],
}

ctx["metadata"] = dict(sorted(image.metadata.items()))
7 changes: 6 additions & 1 deletion isic/studies/views.py
Original file line number Diff line number Diff line change
@@ -200,7 +200,12 @@ def annotation_detail(request, pk):

@needs_object_permission("studies.view_study", (Study, "pk", "pk"))
def study_detail(request, pk):
ctx = {"can_edit": request.user.has_perm("studies.edit_study", Study(pk=pk))}
ctx = {
"can_edit": request.user.has_perm("studies.edit_study", Study(pk=pk)),
"pending_tasks": None,
"next_task": None,
"owners": None,
}
ctx["study"] = get_object_or_404(
Study.objects.annotate(
num_annotators=Count("tasks__annotator", distinct=True),