From 84bfb704bc791b818fd17a706105f57ae7d0e9f6 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 28 Jul 2021 20:00:06 +0100 Subject: [PATCH] . --- sbas/models.py | 10 ++--- sbas/templates/sbas/question_detail.html | 54 ++++++++++++++---------- sbas/views.py | 2 +- 3 files changed, 38 insertions(+), 28 deletions(-) mode change 100755 => 100644 sbas/templates/sbas/question_detail.html diff --git a/sbas/models.py b/sbas/models.py index ab26fc8a..2f2d2969 100644 --- a/sbas/models.py +++ b/sbas/models.py @@ -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, diff --git a/sbas/templates/sbas/question_detail.html b/sbas/templates/sbas/question_detail.html old mode 100755 new mode 100644 index 6a5d3e4e..756b5479 --- a/sbas/templates/sbas/question_detail.html +++ b/sbas/templates/sbas/question_detail.html @@ -1,27 +1,37 @@ -{% extends 'rapids/base.html' %} +{% extends 'sbas/base.html' %} {% block content %} +
+Admin Edit +
+ Created: {{ question.created_date }} +
+ {% autoescape off %} +

{{question.stem}}

+
+
    +
  1. {{ question.a_answer }}
  2. +
  3. {{ question.b_answer }}
  4. +
  5. {{ question.c_answer }}
  6. +
  7. {{ question.d_answer }}
  8. +
  9. {{ question.e_answer }}
  10. +
+ Best answer: {{ question.best_answers }} +
+ {% endautoescape %} +
+ Examinations: {% for exam in question.exams.all %} + {{ exam.name }} + {% endfor %} +
+
+ Category: {{ question.category }} +
- -{% if exam %} -
- -{% if previous > -1 %} -Previous question -{% endif %} - This question is part of exam: {{exam.name}} [{{pos}}/{{exam_length}}] -{% if next %} -Next question -{% endif %} +
+ Author: {% for user in question.author.all %} + {{ author }}, + {% endfor %} +
-{% endif %} - -Edit -Clone -Delete - Add Note -{% if request.user.is_superuser %} -Admin Edit -{% endif %} -{% include 'rapids/question_display_block.html' %} {% endblock %} \ No newline at end of file diff --git a/sbas/views.py b/sbas/views.py index 05a1f093..19e9ff6e 100644 --- a/sbas/views.py +++ b/sbas/views.py @@ -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