Merge branch 'master' of ssh://161.35.163.87:/home/django/rad

This commit is contained in:
Ross
2021-03-25 15:30:08 +00:00
17 changed files with 112 additions and 21 deletions
+18
View File
@@ -0,0 +1,18 @@
# Generated by Django 3.1.3 on 2021-03-19 11:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('rapids', '0020_exam_json_creation_time'),
]
operations = [
migrations.AddField(
model_name='exam',
name='exam_mode',
field=models.BooleanField(default=True, help_text='If an exam should be take in exam_mode'),
),
]
+2 -2
View File
@@ -279,7 +279,7 @@ class Rapid(models.Model):
return images
def GetImageUrls(self):
return ",".join(["http://penracourses.org.uk{}".format(i.url) for i in self.GetImages()])
return ",".join(["https://penracourses.org.uk{}".format(i.url) for i in self.GetImages()])
#def GetNonFeedbackQuestionImages(self):
#return self.GetImages()
@@ -406,7 +406,7 @@ class Exam(ExamBase):
"cached": False,
"exam_type": "rapid",
"exam_name": self.name,
"exam_mode": True,
"exam_mode": self.exam_mode,
"exam_order": exam_order,
"questions": exam_questions,
}
+2 -1
View File
@@ -7,7 +7,8 @@
<a href="{% url 'admin:rapids_exam_change' exam.id %}" title="Edit the Exam using the admin interface">Admin Edit</a>
<h1>Exam: {{ exam.name }}</h1>
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br/>
Normal {{ exam.get_normal_abnormal_breakdown }}
Normal {{ exam.get_normal_abnormal_breakdown }}<br/>
Exam mode: {{ exam.exam_mode }}<br/>
<div class="parent-help" title="Click to enable / disable the exam">
Exam active: <input type="checkbox" id="exam-active-switch" {% if exam.active %}checked{% endif %}> <span class="help-text">[When checked the exam will be available to take in the test system]</span>
+1 -1
View File
@@ -3,5 +3,5 @@
{% block navigation %}
{{block.super}}
<br/>
Exams: {{exam.name}}-> <a href="{% url 'rapids:exam_overview' pk=exam.pk %}">Overview</a> / <a href="{% url 'rapids:mark_overview' pk=exam.pk %}">Mark</a> / <a href="{% url 'rapids:exam_scores_cid' pk=exam.pk %}">Scores</a>
Exams: {{exam.name}}-> <a href="{% url 'rapids:exam_overview' pk=exam.pk %}">Overview</a> / <a href="{% url 'rapids:mark_overview' pk=exam.pk %}">Mark</a> / <a href="{% url 'rapids:exam_scores_cid' pk=exam.pk %}">Scores</a> / <a href="{% url 'rapids:rapid_create_exam' pk=exam.pk %}">Add Question</a>
{% endblock %}
@@ -12,7 +12,7 @@
{% for image in question.images.all %}
<span class="image-block">
Image {{ forloop.counter }}{% if image.feedback_image %} [feedback image]{% endif %}:
<div class="dicom-image rapid-img {% if image.feedback_image %}feedback-img{% endif %}" data-url="http://penracourses.org.uk{{ image.image.url}}"></div>
<div class="dicom-image rapid-img {% if image.feedback_image %}feedback-img{% endif %}" data-url="https://penracourses.org.uk{{ image.image.url}}"></div>
</span>
{% endfor %}
</div>
+1
View File
@@ -36,6 +36,7 @@ urlpatterns = [
path("exam/json/<int:pk>", views.RapidExamViews.exam_json, name="exam_json"),
path("exam/json/<int:pk>/recreate", views.RapidExamViews.exam_json_recreate, name="exam_json_recreate"),
path("create/", views.RapidCreate.as_view(), name="rapid_create"),
path("create/exam/<int:pk>", views.RapidCreate.as_view(), name="rapid_create_exam"),
path("create/defaults",
views.RapidCreationDefaultView.as_view(),
name="rapid_create_defaults"),
+16 -8
View File
@@ -307,16 +307,24 @@ class RapidCreateBase(LoginRequiredMixin, CreateView):
# @login_required
class RapidCreate(RapidCreateBase):
initial = {"laterality": Rapid.NONE}
#initial = {"laterality": Rapid.NONE}
def get_initial(self):
# There has to be a better way...
try:
s = (i.pk for i in self.request.user.rapid_default.site.all())
self.initial.update({"site": s})
except AttributeError:
pass
return self.initial
if "pk" in self.kwargs:
initial = super().get_initial()
exam = get_object_or_404(Exam, pk=self.kwargs["pk"])
initial['exams'] = [exam.id]
return initial
## There has to be a better way...
#try:
# s = (i.pk for i in self.request.user.rapid_default.site.all())
# self.initial.update({"site": s})
#except AttributeError:
# pass
#return self.initial
# fields = '__all__'
# #fields = [ 'condition' ]