This commit is contained in:
Ross
2021-04-26 10:57:47 +01:00
parent 3b6e1dbe29
commit a94264eff0
4 changed files with 11 additions and 4 deletions
+8 -1
View File
@@ -117,9 +117,16 @@ class RapidForm(ModelForm):
self.fields["laterality"] = ChoiceField(
choices=Rapid.LATERALITY_CHOICES, required=False, widget=RadioSelect()
)
user = self.request.user
if user.groups.filter(name="rapid_checker").exists():
return Exam.objects.all()
exam_queryset = Exam.objects.filter(author__id=user.id)
self.fields["exams"] = ModelMultipleChoiceField(
required=False,
queryset=Exam.objects.all(),
queryset=exam_queryset,
widget=FilteredSelectMultiple(verbose_name="Exams", is_stacked=False),
)
+1 -1
View File
@@ -19,7 +19,7 @@ Rapids:
{% if request.user.is_authenticated %}
<a href="{% url 'rapids:index' %}">Packets</a> /
<a href="{% url 'rapids:exam_list' %}">Exams</a> /
<a href="{% url 'rapids:exam_create' %}" title="Create a new exam">Create Exam</a>
<a href="{% url 'rapids:exam_create' %}" title="Create a new exam">Create Exam</a> /
<a href="{% url 'rapids:rapid_view' %}">Questions</a> /
<a href="{% url 'rapids:rapid_create' %}" title="Create a new question">Create Question</a>
{% endif %}
+1
View File
@@ -333,6 +333,7 @@
{% block content %}
<h2>Submit Rapid</h2>
<a href="{% url 'rapids:rapid_create_defaults' %}">Edit defaults</a>
Abnormality, Region and Laterality are used to categorise within the system (they are not used for marking). String answers that match those added below will be used for automatic marking. Multiple images can be added to a question. If the feedback image box is checked they will not be displayed when taking the question.
<form action="" method="post" enctype="multipart/form-data" id="rapid-form">
{% csrf_token %}
<a href="/rapids/abnormality/create" id="add_abnormality" class="add-popup"
+1 -2
View File
@@ -920,8 +920,7 @@ class ExamViewSet(viewsets.ModelViewSet):
def get_queryset(self):
"""
This view should return a list of all the purchases
for the currently authenticated user.
This view should return a list exams available to a user.
"""
user = self.request.user
if user.groups.filter(name="rapid_checker").exists():