.
This commit is contained in:
+5
-5
@@ -40,7 +40,7 @@ class Question(models.Model):
|
||||
# I doubt this is the best way to structure the model
|
||||
# (but it should work)
|
||||
a_answer = models.TextField(
|
||||
help_text=answer_help_text, default=True
|
||||
help_text=answer_help_text
|
||||
)
|
||||
a_feedback = models.TextField(
|
||||
blank=True,
|
||||
@@ -48,7 +48,7 @@ class Question(models.Model):
|
||||
)
|
||||
|
||||
b_answer = models.TextField(
|
||||
help_text=answer_help_text, default=True
|
||||
help_text=answer_help_text
|
||||
)
|
||||
b_feedback = models.TextField(
|
||||
blank=True,
|
||||
@@ -56,7 +56,7 @@ class Question(models.Model):
|
||||
)
|
||||
|
||||
c_answer = models.TextField(
|
||||
help_text=answer_help_text, default=True
|
||||
help_text=answer_help_text
|
||||
)
|
||||
c_feedback = models.TextField(
|
||||
blank=True,
|
||||
@@ -64,7 +64,7 @@ class Question(models.Model):
|
||||
)
|
||||
|
||||
d_answer = models.TextField(
|
||||
help_text=answer_help_text, default=True
|
||||
help_text=answer_help_text
|
||||
)
|
||||
d_feedback = models.TextField(
|
||||
blank=True,
|
||||
@@ -72,7 +72,7 @@ class Question(models.Model):
|
||||
)
|
||||
|
||||
e_answer = models.TextField(
|
||||
help_text=answer_help_text, default=True
|
||||
help_text=answer_help_text
|
||||
)
|
||||
e_feedback = models.TextField(
|
||||
blank=True,
|
||||
|
||||
Executable → Regular
+32
-22
@@ -1,27 +1,37 @@
|
||||
{% extends 'rapids/base.html' %}
|
||||
{% extends 'sbas/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="question">
|
||||
<a href="{% url 'admin:sbas_question_change' question.id %}" title="Edit the Question using the admin interface">Admin Edit</a>
|
||||
<div class="date">
|
||||
Created: {{ question.created_date }}
|
||||
</div>
|
||||
{% autoescape off %}
|
||||
<h2>{{question.stem}}</h2>
|
||||
<div>
|
||||
<ol>
|
||||
<li>{{ question.a_answer }}</li>
|
||||
<li>{{ question.b_answer }}</li>
|
||||
<li>{{ question.c_answer }}</li>
|
||||
<li>{{ question.d_answer }}</li>
|
||||
<li>{{ question.e_answer }}</li>
|
||||
</ol>
|
||||
Best answer: {{ question.best_answers }}
|
||||
</div>
|
||||
{% endautoescape %}
|
||||
<div>
|
||||
Examinations: {% for exam in question.exams.all %}
|
||||
<a href="{% url 'sbas:exam_overview' pk=exam.pk %}">{{ exam.name }}</a>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div>
|
||||
Category: {{ question.category }}
|
||||
</div>
|
||||
|
||||
|
||||
{% if exam %}
|
||||
<div>
|
||||
|
||||
{% if previous > -1 %}
|
||||
<a href="{% url 'rapids:exam_question_detail' exam.id previous %}">Previous question</a>
|
||||
{% endif %}
|
||||
This question is part of exam: <a href="{% url 'rapids:exam_overview' exam.id %}">{{exam.name}}</a> [{{pos}}/{{exam_length}}]
|
||||
{% if next %}
|
||||
<a href="{% url 'rapids:exam_question_detail' exam.id next %}">Next question</a>
|
||||
{% endif %}
|
||||
<div>
|
||||
Author: {% for user in question.author.all %}
|
||||
{{ author }},
|
||||
{% endfor %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<a href="{% url 'rapids:rapid_update' pk=question.pk %}" title="Edit the Rapid">Edit</a>
|
||||
<a href="{% url 'rapids:rapid_clone' pk=question.pk %}" title="Clone the Rapid (duplicate everything but the images)">Clone</a>
|
||||
<a href="{% url 'rapids:question_delete' pk=question.pk %}" title="Delete the Rapid">Delete</a>
|
||||
<a href="{% url 'rapids:rapid_add_note' pk=question.pk %}"> Add Note</a>
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="{% url 'admin:rapids_rapid_change' question.id %}" title="Edit the Rapid using the admin interface">Admin Edit</a>
|
||||
{% endif %}
|
||||
{% include 'rapids/question_display_block.html' %}
|
||||
{% endblock %}
|
||||
+1
-1
@@ -41,7 +41,7 @@ from django.core.exceptions import PermissionDenied
|
||||
class AuthorOrCheckerRequiredMixin(object):
|
||||
def get_object(self, *args, **kwargs):
|
||||
obj = super().get_object(*args, **kwargs)
|
||||
if self.request.user.groups.filter(name="physics_checker").exists():
|
||||
if self.request.user.groups.filter(name="sbas_checker").exists():
|
||||
return obj
|
||||
if self.request.user not in obj.author.all():
|
||||
raise PermissionDenied() # or Http404
|
||||
|
||||
Reference in New Issue
Block a user