.
This commit is contained in:
@@ -62,6 +62,15 @@ class QuestionTable(tables.Table):
|
||||
)
|
||||
sequence = ("view", "stem", "answers", "exams")
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
data.prefetch_related(
|
||||
"category", "author", "exams"
|
||||
),
|
||||
*args,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
def render_stem(self, value):
|
||||
return mark_safe(value)
|
||||
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
{% extends 'physics/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Examinations</h1>
|
||||
<div class="physics">
|
||||
Active exams:<br/>
|
||||
<ul class="exam-list">
|
||||
{% for exam in exams %}
|
||||
{% if exam.active %}
|
||||
<li>
|
||||
<a href="{% url 'physics:exam_overview' pk=exam.pk %}" class="flex-col">{{exam.name}}</a> <a href="{% url 'physics: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>
|
||||
Publish results: <input type="checkbox" class="exam-publish-results-switch" data-posturl="{% url 'physics:exam_toggle_results_published' pk=exam.pk %}"
|
||||
{% if exam.publish_results %}checked{% endif %}>
|
||||
</span>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
Inactive exams:<br/>
|
||||
<ul class="exam-list">
|
||||
{% for exam in exams %}
|
||||
{% if not exam.active %}
|
||||
<li>
|
||||
<a href="{% url 'physics:exam_overview' pk=exam.pk %}" class="flex-col">{{exam.name}}</a> <a href="{% url 'physics: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 'physics:active_exams' %}">Available exams</a>
|
||||
</p>
|
||||
|
||||
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,22 +0,0 @@
|
||||
{% extends 'physics/base.html' %}
|
||||
|
||||
{% block css %}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<div id="view-filter-options">
|
||||
<h3>Filter SBA Questions</h3>
|
||||
<form action="" method="get">
|
||||
|
||||
{{ filter.form }}
|
||||
|
||||
<input class="btn btn-primary btn-sm mt-1 mb-1" type="submit" />
|
||||
</form>
|
||||
</div>
|
||||
{% autoescape off %}
|
||||
{% load render_table from django_tables2 %}
|
||||
{% render_table table %}
|
||||
{% endautoescape %}
|
||||
|
||||
{% endblock %}
|
||||
+7
-1
@@ -426,10 +426,16 @@ class QuestionView(
|
||||
):
|
||||
model = Question
|
||||
table_class = QuestionTable
|
||||
template_name = "physics/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"] = "physics"
|
||||
return context
|
||||
|
||||
|
||||
|
||||
class UserAnswerView(AuthorOrCheckerRequiredMixin, LoginRequiredMixin, DetailView):
|
||||
model = CidUserAnswer
|
||||
|
||||
Reference in New Issue
Block a user