.
This commit is contained in:
+10
-1
@@ -63,6 +63,8 @@ from crispy_forms.helper import FormHelper
|
||||
|
||||
from atlas.helpers import get_cases_available_to_user
|
||||
|
||||
from typing import Any
|
||||
|
||||
class CaseSelect(Select):
|
||||
template_name = "atlas/case_select_widget.html"
|
||||
|
||||
@@ -72,8 +74,14 @@ class CaseSelect(Select):
|
||||
|
||||
print(option)
|
||||
|
||||
|
||||
return option
|
||||
|
||||
def get_context(self, name: str, value, attrs) -> dict[str, Any]:
|
||||
context = super().get_context(name, value, attrs)
|
||||
return context
|
||||
|
||||
|
||||
pass
|
||||
|
||||
class ConditionForm(ModelForm):
|
||||
@@ -326,7 +334,8 @@ class CaseForm(ModelForm):
|
||||
# self.fields["series"].queryset =
|
||||
|
||||
if self.user.groups.filter(name="atlas_editor").exists():
|
||||
case_queryset = Case.objects.all().order_by("pk")
|
||||
case_queryset = Case.objects.all().order_by("pk").prefetch_related(
|
||||
)
|
||||
else:
|
||||
case_queryset = get_cases_available_to_user(self.user)
|
||||
self.fields["previous_case"].queryset=case_queryset
|
||||
|
||||
+6
-2
@@ -417,7 +417,7 @@ class Case(models.Model, AuthorMixin, QuestionMixin):
|
||||
for s in self.series.all():
|
||||
html += s.get_block()
|
||||
|
||||
return html
|
||||
return mark_safe(html)
|
||||
|
||||
def get_long_str(self):
|
||||
examinations = [series.get_examination() for series in self.series.all()]
|
||||
@@ -1301,7 +1301,11 @@ class UncategorisedDicom(models.Model):
|
||||
if self.image:
|
||||
ds = self.get_dicom_info()
|
||||
|
||||
self.series_instance_uid = ds["SeriesInstanceUID"].value
|
||||
try:
|
||||
self.series_instance_uid = ds["SeriesInstanceUID"].value
|
||||
except AttributeError:
|
||||
# ? only called with invalid dicom?
|
||||
self.series_instance_uid = ds["SeriesInstanceUID"]
|
||||
|
||||
# if self.check_for_duplicates():
|
||||
# return DuplicateDicom
|
||||
|
||||
@@ -1,15 +1,38 @@
|
||||
<details>
|
||||
<details class="case-details">
|
||||
<summary>Cases</summary>
|
||||
<ul>
|
||||
<input type="text" placeholder="Search Cases..."
|
||||
_="on keyup
|
||||
if the event's key is 'Escape'
|
||||
set my value to ''
|
||||
trigger keyup
|
||||
else
|
||||
log 'test' then
|
||||
show .case-option in #case-options when its textContent contains my value
|
||||
">
|
||||
<ul id="case-options">
|
||||
{% for group_name, group_choices, group_index in widget.optgroups %}
|
||||
{% for widget in group_choices %}
|
||||
{% include widget.template_name %}
|
||||
{{ widget.instance }}
|
||||
|
||||
{% with widget.value.instance as case %}
|
||||
{% if not forloop.parentloop.first %}
|
||||
<li class="case-option">
|
||||
<span class="d-flex flex-row ">
|
||||
<span class="p-2">{{case.id}}</span>
|
||||
<span class="p-2">{{case.title}}</span>
|
||||
<span class="p-2">{{case.created_date}}</span>
|
||||
<button class="p-2 btn btn-sm"
|
||||
type="button"
|
||||
_="on click set (next <select/>)'s value to '{{case.pk}}' then remove @open from .case-details then go to top of (next <select/>)'s parent"
|
||||
>select</button>
|
||||
</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</detailS>
|
||||
</details>
|
||||
|
||||
<select name="{{ widget.name }}"{% include "django/forms/widgets/attrs.html" %}>{% for group_name, group_choices, group_index in widget.optgroups %}{% if group_name %}
|
||||
<optgroup label="{{ group_name }}">{% endif %}{% for widget in group_choices %}
|
||||
|
||||
@@ -33,7 +33,13 @@
|
||||
{% if collection.collection_type == "VIV" %}
|
||||
<p>View as a viva collection <a href='{% url "atlas:collection_viva" collection.pk %}'>here</a>
|
||||
{% else %}
|
||||
<p>This collection will be available to view/take <a href='{{collection.get_take_url}}'>here</a> (when active)
|
||||
<p>This collection will be available to view/take <a href='{{collection.get_take_url}}' id="take-url">here</a>{% if not collection.active %} (when active){% endif %} <button
|
||||
_="on click
|
||||
writeText(#take-url's href) on navigator.clipboard
|
||||
put 'copied url!' into me
|
||||
wait 1s
|
||||
put 'copy url' into me"
|
||||
class="btn btn-sm">copy link</button>
|
||||
<p>Review collection <a href='{% url "atlas:collection_viva" collection.pk %}'>here</a>
|
||||
{% endif %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user