.
This commit is contained in:
@@ -56,6 +56,15 @@ class QuestionTable(tables.Table):
|
||||
)
|
||||
sequence = ("view", "stem", "answers", "exams")
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
data.prefetch_related(
|
||||
"category", "exams", "author"
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def render_stem(self, value):
|
||||
return mark_safe(value)
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
{% extends 'sbas/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Examinations</h1>
|
||||
<div class="sbas">
|
||||
Active exams:<br/>
|
||||
<ul class="exam-list">
|
||||
{% for exam in exams %}
|
||||
{% if exam.active %}
|
||||
<li>
|
||||
<a href="{% url 'sbas:exam_overview' pk=exam.pk %}" class="flex-col">{{exam.name}}</a> <a href="{% url 'sbas: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 'sbas:exam_overview' pk=exam.pk %}" class="flex-col">{{exam.name}}</a> <a href="{% url 'sbas: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>
|
||||
|
||||
<p>Active exams will be available to take at the below url:
|
||||
<a href="{% url 'sbas:active_exams' %}">Available exams</a>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
+6
-1
@@ -293,10 +293,15 @@ GenericExamViews = ExamViews(
|
||||
class QuestionView(LoginRequiredMixin, SingleTableMixin, FilterView):
|
||||
model = Question
|
||||
table_class = QuestionTable
|
||||
template_name = "sbas/question_view.html"
|
||||
template_name = "question_table_view.html"
|
||||
|
||||
filterset_class = QuestionFilter
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["app_name"] = "anatomy"
|
||||
return context
|
||||
|
||||
|
||||
class UserAnswerView(LoginRequiredMixin, DetailView):
|
||||
model = CidUserAnswer
|
||||
|
||||
Reference in New Issue
Block a user