.
This commit is contained in:
+2
-2
@@ -923,14 +923,14 @@ def get_structure_id(request):
|
|||||||
return HttpResponse("/")
|
return HttpResponse("/")
|
||||||
|
|
||||||
|
|
||||||
class AnatomyQuestionView(SingleTableMixin, FilterView):
|
class AnatomyQuestionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = AnatomyQuestion
|
model = AnatomyQuestion
|
||||||
table_class = AnatomyQuestionTable
|
table_class = AnatomyQuestionTable
|
||||||
template_name = "anatomy/anatomy_question_view.html"
|
template_name = "anatomy/anatomy_question_view.html"
|
||||||
|
|
||||||
filterset_class = AnatomyQuestionFilter
|
filterset_class = AnatomyQuestionFilter
|
||||||
|
|
||||||
class AnatomyUserAnswerView(SingleTableMixin, FilterView):
|
class AnatomyUserAnswerView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = CidUserAnswer
|
model = CidUserAnswer
|
||||||
table_class = AnatomyUserAnswerTable
|
table_class = AnatomyUserAnswerTable
|
||||||
template_name = "anatomy/anatomy_question_view.html"
|
template_name = "anatomy/anatomy_question_view.html"
|
||||||
|
|||||||
@@ -131,6 +131,15 @@ class ExamViews(View, LoginRequiredMixin):
|
|||||||
|
|
||||||
exam = get_object_or_404(self.Exam, pk=pk)
|
exam = get_object_or_404(self.Exam, pk=pk)
|
||||||
|
|
||||||
|
if "add_exam_questions" in request.POST:
|
||||||
|
question_ids = json.loads(request.POST.get("add_exam_questions"))
|
||||||
|
question_objects = self.Question.objects.filter(pk__in=question_ids)
|
||||||
|
|
||||||
|
exam.exam_questions.add(question_objects)
|
||||||
|
exam.save()
|
||||||
|
data = {"status": "success"}
|
||||||
|
return JsonResponse(data, status=200)
|
||||||
|
|
||||||
if "set_open_access" in request.POST:
|
if "set_open_access" in request.POST:
|
||||||
if request.POST.get("set_open_access") == "true":
|
if request.POST.get("set_open_access") == "true":
|
||||||
state = True
|
state = True
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.1.3 on 2021-02-25 17:59
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('longs', '0025_auto_20210217_2218'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='long',
|
||||||
|
name='description',
|
||||||
|
field=models.TextField(blank=True, help_text='Description of the case, for admin organisation, will not be visible when taking'),
|
||||||
|
),
|
||||||
|
]
|
||||||
+6
-1
@@ -58,6 +58,11 @@ def findMiddle(input_list):
|
|||||||
class Long(models.Model):
|
class Long(models.Model):
|
||||||
# author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
|
# author = models.ForeignKey('auth.User', on_delete=models.CASCADE)
|
||||||
# image = models.ImageField()
|
# image = models.ImageField()
|
||||||
|
description = models.TextField(
|
||||||
|
blank=True,
|
||||||
|
help_text="Description of the case, for admin organisation, will not be visible when taking",
|
||||||
|
)
|
||||||
|
|
||||||
history = models.TextField(null=True, blank=True)
|
history = models.TextField(null=True, blank=True)
|
||||||
|
|
||||||
feedback = models.TextField(null=True, blank=True)
|
feedback = models.TextField(null=True, blank=True)
|
||||||
@@ -121,7 +126,7 @@ class Long(models.Model):
|
|||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
examinations = [series.get_examination() for series in self.series.all()]
|
examinations = [series.get_examination() for series in self.series.all()]
|
||||||
return "{} : {}".format(self.history, ", ".join(examinations))
|
return "{} : {}".format(self.description, ", ".join(examinations))
|
||||||
|
|
||||||
def GetExams(self):
|
def GetExams(self):
|
||||||
e = self.exams.all().values_list("name", flat=True)
|
e = self.exams.all().values_list("name", flat=True)
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ class LongTable(tables.Table):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Long
|
model = Long
|
||||||
template_name = "django_tables2/bootstrap4.html"
|
template_name = "django_tables2/bootstrap4.html"
|
||||||
fields = ("history", "created_date", "author")
|
fields = ("description", "history", "created_date", "author")
|
||||||
sequence = ("view", "series", "exams")
|
sequence = ("view", "series", "exams")
|
||||||
|
|
||||||
class PopupLinkColumn(tables.Column):
|
class PopupLinkColumn(tables.Column):
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<div class="date">
|
<div class="date">
|
||||||
{{ question.created_date }}
|
{{ question.created_date }}
|
||||||
</div>
|
</div>
|
||||||
|
<p class="pre-whitespace"><b>Description:</b> {{ question.description }}</p>
|
||||||
|
|
||||||
<p class="pre-whitespace"><b>History:</b> {{ question.history }}</p>
|
<p class="pre-whitespace"><b>History:</b> {{ question.history }}</p>
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -586,14 +586,14 @@ def get_region_id(request):
|
|||||||
return HttpResponse("/")
|
return HttpResponse("/")
|
||||||
|
|
||||||
|
|
||||||
class LongView(SingleTableMixin, FilterView):
|
class LongView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = Long
|
model = Long
|
||||||
table_class = LongTable
|
table_class = LongTable
|
||||||
template_name = "longs/view.html"
|
template_name = "longs/view.html"
|
||||||
|
|
||||||
filterset_class = LongFilter
|
filterset_class = LongFilter
|
||||||
|
|
||||||
class LongSeriesView(SingleTableMixin, FilterView):
|
class LongSeriesView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = LongSeries
|
model = LongSeries
|
||||||
table_class = LongSeriesTable
|
table_class = LongSeriesTable
|
||||||
template_name = "longs/view.html"
|
template_name = "longs/view.html"
|
||||||
|
|||||||
@@ -15,4 +15,32 @@
|
|||||||
</div>
|
</div>
|
||||||
{% render_table table %}
|
{% render_table table %}
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function () {
|
||||||
|
$("#button-select-add-exam").click(function () {
|
||||||
|
$.ajax({
|
||||||
|
url: "{% url 'rapids:exam_json_edit' pk=exam.pk %}",
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
add_exam_questions: true,
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.status == "success") {
|
||||||
|
toastr.info('Questions added to exams.')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.always(function () {
|
||||||
|
console.log('[Done]');
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
+1
-1
@@ -486,7 +486,7 @@ def get_region_id(request):
|
|||||||
return HttpResponse("/")
|
return HttpResponse("/")
|
||||||
|
|
||||||
|
|
||||||
class RapidView(SingleTableMixin, FilterView):
|
class RapidView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||||
model = Rapid
|
model = Rapid
|
||||||
table_class = RapidTable
|
table_class = RapidTable
|
||||||
template_name = "rapids/view.html"
|
template_name = "rapids/view.html"
|
||||||
|
|||||||
Reference in New Issue
Block a user