Merge branch 'master' of ssh://161.35.163.87:/home/django/rad
This commit is contained in:
@@ -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 = [
|
||||
('anatomy', '0035_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'),
|
||||
),
|
||||
]
|
||||
@@ -14,6 +14,7 @@
|
||||
<div class="parent-help" title="Click to enable / disable the exam results">
|
||||
Publish results: <input type="checkbox" id="exam-publish-results-switch" {% if exam.publish_results %}checked{% endif %}> <span class="help-text">[When checked the exam results will be available on this site]</span>
|
||||
</div>
|
||||
Exam mode: {{ exam.exam_mode }}
|
||||
<p><a href="{% url 'anatomy:mark_overview' pk=exam.pk %}"><button>Mark exam</button></a></p>
|
||||
|
||||
<ol id="full-question-list" class="sortable">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<a href="{% url 'anatomy:anatomy_question_update' question.id %}" title="Edit the Question">Edit</a> <a href="{% url 'admin:anatomy_anatomyquestion_change' question.id %}" title="Edit the Question using the admin interface">Admin Edit</a>
|
||||
<h3>{{ question.question_type }}</h3>
|
||||
|
||||
<div id="single-dicom-viewer" class="marking-dicom" data-images="http://penracourses.org.uk{{ question.image.url}}" data-annotations='{{question.get_annotations}}'>
|
||||
<div id="single-dicom-viewer" class="marking-dicom" data-images="https://penracourses.org.uk{{ question.image.url}}" data-annotations='{{question.get_annotations}}'>
|
||||
</div>
|
||||
<div class="marking">
|
||||
<form method="POST" class="post-form">{% csrf_token %}
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
<button id="save-annotations">Save Annotations</button>
|
||||
<div id="dicom-image" class="dicom-image" data-url="http://penracourses.org.uk{{ question.image.url}}"
|
||||
<div id="dicom-image" class="dicom-image" data-url="https://penracourses.org.uk{{ question.image.url}}"
|
||||
data-annotations='{{question.image_annotations}}' data-edit_annotation=true></div>
|
||||
<!-- testing -->
|
||||
<!--<div id="dicom-image" data-url="http://localhost:8000/static/abdoct.jpg"
|
||||
|
||||
@@ -56,6 +56,10 @@ class ExamBase(models.Model):
|
||||
help_text="If an exam should be available", default=True
|
||||
)
|
||||
|
||||
exam_mode = models.BooleanField(
|
||||
help_text="If an exam should be take in exam_mode", default=True
|
||||
)
|
||||
|
||||
publish_results = models.BooleanField(
|
||||
help_text="If an exams results should be available", default=True
|
||||
)
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.3 on 2021-03-19 11:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('longs', '0031_auto_20210309_1527'),
|
||||
]
|
||||
|
||||
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'),
|
||||
),
|
||||
]
|
||||
+3
-3
@@ -120,7 +120,7 @@ class Long(models.Model):
|
||||
help_text="If the json cache needs updating", default=False
|
||||
)
|
||||
|
||||
json_creation_time = models.DateTimeField(blank=True, default=None)
|
||||
json_creation_time = models.DateTimeField(blank=True, default=None, null=True)
|
||||
|
||||
#question_file = models.FileField(upload_to=question_file_directory_path, blank=True, null=True)
|
||||
|
||||
@@ -158,7 +158,7 @@ class Long(models.Model):
|
||||
|
||||
def GetImageUrls(self):
|
||||
return ",".join(
|
||||
["http://penracourses.org.uk{}".format(i.url) for i in self.GetImages()]
|
||||
["https://penracourses.org.uk{}".format(i.url) for i in self.GetImages()]
|
||||
)
|
||||
|
||||
def GetUnmarkedAnswerCount(self):
|
||||
@@ -343,7 +343,7 @@ class LongSeries(models.Model):
|
||||
|
||||
def get_image_urls(self, feedback=False):
|
||||
images = [
|
||||
"http://penracourses.org.uk{}".format(i.image.url)
|
||||
"https://penracourses.org.uk{}".format(i.image.url)
|
||||
for i in self.images.all()
|
||||
]
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
<div class="longs">
|
||||
<a href="{% url 'admin:longs_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.
|
||||
This exam has {{question_number}} questions. Time limit: {{exam.time_limit}} seconds.<br/>
|
||||
Exam mode: {{ exam.exam_mode }}
|
||||
|
||||
<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
|
||||
|
||||
@@ -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 = [
|
||||
('physics', '0004_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'),
|
||||
),
|
||||
]
|
||||
+5
-2
@@ -25,7 +25,7 @@ with open('/etc/secret_key') as f:
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "161.35.163.87", "penracourses.org.uk"]
|
||||
ALLOWED_HOSTS = ["localhost", "127.0.0.1", "161.35.163.87", "penracourses.org.uk", "www.penracourses.org.uk"]
|
||||
|
||||
# Application definition
|
||||
|
||||
@@ -148,10 +148,13 @@ USE_TZ = True
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.11/howto/static-files/
|
||||
|
||||
SECURE_SSL_REDIRECT = True
|
||||
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
STATIC_ROOT = 'static/'
|
||||
|
||||
REMOTE_URL = "http://penracourses.org.uk"
|
||||
REMOTE_URL = "https://penracourses.org.uk"
|
||||
#
|
||||
#if DEBUG:
|
||||
# STATIC_URL = REMOTE_URL + STATIC_URL
|
||||
|
||||
@@ -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
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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
@@ -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' ]
|
||||
|
||||
Reference in New Issue
Block a user