.
This commit is contained in:
+12
-5
@@ -41,7 +41,7 @@ class MarkAnatomyQuestionForm(Form):
|
|||||||
|
|
||||||
class AnatomyQuestionForm(ModelForm):
|
class AnatomyQuestionForm(ModelForm):
|
||||||
|
|
||||||
exams = ModelMultipleChoiceField(required=False, queryset=Exam.objects.all())
|
#exams = ModelMultipleChoiceField(required=False, queryset=Exam.objects.all())
|
||||||
|
|
||||||
class Media:
|
class Media:
|
||||||
# Django also includes a few javascript files necessary
|
# Django also includes a few javascript files necessary
|
||||||
@@ -90,10 +90,17 @@ class AnatomyQuestionForm(ModelForm):
|
|||||||
queryset=BodyPart.objects.all(),
|
queryset=BodyPart.objects.all(),
|
||||||
)
|
)
|
||||||
|
|
||||||
# self.fields["exams"] = ModelChoiceField(
|
if self.user.groups.filter(name="anatomy_checker").exists():
|
||||||
# required=False,
|
exam_queryset = Exam.objects.all()
|
||||||
# queryset=Exam.objects.all(),
|
else:
|
||||||
# )
|
exam_queryset = Exam.objects.filter(author__id=self.user.id)
|
||||||
|
|
||||||
|
self.fields["exams"] = ModelMultipleChoiceField(
|
||||||
|
required=False,
|
||||||
|
queryset=exam_queryset,
|
||||||
|
widget=FilteredSelectMultiple(verbose_name="Exams", is_stacked=False),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if kwargs.get("instance"):
|
if kwargs.get("instance"):
|
||||||
# We get the 'initial' keyword argument or initialize it
|
# We get the 'initial' keyword argument or initialize it
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
error: function(e) {
|
error: function(e) {
|
||||||
toastr.warning(`Error saving annotations (${e})`)
|
toastr.warning(`Error saving annotations`)
|
||||||
console.log(e);
|
console.log(e);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user