.
This commit is contained in:
@@ -526,6 +526,8 @@ class RapidImage(models.Model):
|
||||
|
||||
is_dicom = models.BooleanField(default=False)
|
||||
|
||||
|
||||
|
||||
def image_tag(self):
|
||||
if self.image:
|
||||
return mark_safe(
|
||||
|
||||
+4
-4
@@ -12,12 +12,12 @@ from easy_thumbnails.exceptions import InvalidImageFormatError
|
||||
|
||||
class ImageColumn(tables.Column):
|
||||
def render(self, value):
|
||||
obj = value.first()
|
||||
obj = value.all()
|
||||
|
||||
if obj is None:
|
||||
if not obj:
|
||||
return format_html('<span>No image<span>')
|
||||
|
||||
image_object = obj.image
|
||||
image_object = obj[0].image
|
||||
try:
|
||||
thumbnailer = get_thumbnailer(image_object)
|
||||
return format_html('<img src="/media/{}" />', thumbnailer["exam-list"])
|
||||
@@ -60,7 +60,7 @@ class RapidTable(tables.Table):
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
data.prefetch_related(
|
||||
"abnormality", "region", "examination", "images", "exams", "author"
|
||||
"abnormality", "region", "examination", "images", "exams", "author"
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
{% extends 'rapids/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Examinations</h1>
|
||||
<div class="rapids">
|
||||
Active exams:<br/>
|
||||
<ul class="exam-list">
|
||||
{% for exam in exams %}
|
||||
{% if exam.active %}
|
||||
<li>
|
||||
<a href="{% url 'rapids:exam_overview' pk=exam.pk %}" class="flex-col">{{exam.name}}</a> <a href="{% url 'rapids:mark_overview' pk=exam.pk %}" class="flex-col">Mark</a><a href="{% url 'rapids:exam_scores_cid' pk=exam.pk %}" class="flex-col">Scores</a> <span class="flex-col icon-container"><span class="published-icon {% if exam.publish_results %}published{% endif %}">Results Published</span></span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Inactive exams:<br/>
|
||||
<ul class="exam-list">
|
||||
{% for exam in exams %}
|
||||
{% if not exam.active %}
|
||||
<li>
|
||||
<a href="{% url 'rapids:exam_overview' pk=exam.pk %}" class="flex-col">{{exam.name}}</a> <a href="{% url 'rapids:mark_overview' pk=exam.pk %}" class="flex-col">Mark</a><a href="{% url 'rapids:exam_scores_cid' pk=exam.pk %}" class="flex-col">Scores</a> <span class="flex-col icon-container"><span class="published-icon {% if exam.publish_results %}published{% endif %}">Results Published</span></span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -8,12 +8,17 @@ APP_NAMES = ("rapids", "anatomy", "longs", "physics", "sbas")
|
||||
def create_superuser(db, django_user_model):
|
||||
return django_user_model.objects.create_superuser("admin", "ross@xkjq.uk", "adminpassword")
|
||||
|
||||
#@pytest.fixture
|
||||
#def create_exam(db):
|
||||
# return Exam.objects.create(name="test exam", exam_mode=True)
|
||||
|
||||
# Very basic tests, make sure we can hit key urls without error
|
||||
|
||||
@pytest.mark.parametrize("app_name", APP_NAMES)
|
||||
def test_index(client, create_superuser, app_name):
|
||||
client.login(username="admin", password="adminpassword")
|
||||
response = client.get(reverse(f'{app_name}:index'))
|
||||
print(reverse(f'{app_name}:index'))
|
||||
print(response.status_code)
|
||||
print(response)
|
||||
print(response.content)
|
||||
assert response.status_code == 200
|
||||
+5
-1
@@ -504,10 +504,14 @@ def get_region_id(request):
|
||||
class RapidView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Rapid
|
||||
table_class = RapidTable
|
||||
template_name = "rapids/view.html"
|
||||
template_name = "question_table_view.html"
|
||||
|
||||
filterset_class = RapidFilter
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["app_name"] = "rapids"
|
||||
return context
|
||||
|
||||
|
||||
@login_required
|
||||
|
||||
Reference in New Issue
Block a user