.
This commit is contained in:
+8
-1
@@ -117,9 +117,16 @@ class RapidForm(ModelForm):
|
|||||||
self.fields["laterality"] = ChoiceField(
|
self.fields["laterality"] = ChoiceField(
|
||||||
choices=Rapid.LATERALITY_CHOICES, required=False, widget=RadioSelect()
|
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(
|
self.fields["exams"] = ModelMultipleChoiceField(
|
||||||
required=False,
|
required=False,
|
||||||
queryset=Exam.objects.all(),
|
queryset=exam_queryset,
|
||||||
widget=FilteredSelectMultiple(verbose_name="Exams", is_stacked=False),
|
widget=FilteredSelectMultiple(verbose_name="Exams", is_stacked=False),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ Rapids:
|
|||||||
{% if request.user.is_authenticated %}
|
{% if request.user.is_authenticated %}
|
||||||
<a href="{% url 'rapids:index' %}">Packets</a> /
|
<a href="{% url 'rapids:index' %}">Packets</a> /
|
||||||
<a href="{% url 'rapids:exam_list' %}">Exams</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_view' %}">Questions</a> /
|
||||||
<a href="{% url 'rapids:rapid_create' %}" title="Create a new question">Create Question</a>
|
<a href="{% url 'rapids:rapid_create' %}" title="Create a new question">Create Question</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@@ -333,6 +333,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h2>Submit Rapid</h2>
|
<h2>Submit Rapid</h2>
|
||||||
<a href="{% url 'rapids:rapid_create_defaults' %}">Edit defaults</a>
|
<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">
|
<form action="" method="post" enctype="multipart/form-data" id="rapid-form">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<a href="/rapids/abnormality/create" id="add_abnormality" class="add-popup"
|
<a href="/rapids/abnormality/create" id="add_abnormality" class="add-popup"
|
||||||
|
|||||||
+1
-2
@@ -920,8 +920,7 @@ class ExamViewSet(viewsets.ModelViewSet):
|
|||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
"""
|
"""
|
||||||
This view should return a list of all the purchases
|
This view should return a list exams available to a user.
|
||||||
for the currently authenticated user.
|
|
||||||
"""
|
"""
|
||||||
user = self.request.user
|
user = self.request.user
|
||||||
if user.groups.filter(name="rapid_checker").exists():
|
if user.groups.filter(name="rapid_checker").exists():
|
||||||
|
|||||||
Reference in New Issue
Block a user