.
This commit is contained in:
+5
-27
@@ -7,7 +7,7 @@ from django.forms import (
|
||||
CharField,
|
||||
)
|
||||
from django.forms import inlineformset_factory
|
||||
from generic.forms import ExamFormMixin
|
||||
from generic.forms import ExamAuthorFormMixin, ExamFormMixin
|
||||
|
||||
from rapids.models import (
|
||||
Abnormality,
|
||||
@@ -230,31 +230,9 @@ AnswerUpdateFormSet = inlineformset_factory(
|
||||
|
||||
# This should be made generic?
|
||||
class ExamForm(ExamFormMixin, ModelForm):
|
||||
class Meta:
|
||||
class Meta(ExamFormMixin.Meta):
|
||||
model = Exam
|
||||
fields = [
|
||||
"name",
|
||||
"time_limit",
|
||||
"open_access",
|
||||
"authors_only",
|
||||
"exam_mode",
|
||||
"include_history",
|
||||
"active",
|
||||
"publish_results",
|
||||
"archive",
|
||||
"cid_user_groups",
|
||||
"user_user_groups",
|
||||
#"author",
|
||||
]
|
||||
|
||||
class ExamAuthorForm(ModelForm):
|
||||
class Meta:
|
||||
model = Exam
|
||||
fields = ["author"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
ModelForm.__init__(self, *args, **kwargs)
|
||||
self.fields["author"] = ModelMultipleChoiceField(
|
||||
queryset=User.objects.all(),
|
||||
widget=FilteredSelectMultiple(verbose_name="Authors", is_stacked=False),
|
||||
)
|
||||
class ExamAuthorForm(ExamAuthorFormMixin):
|
||||
class Meta(ExamAuthorFormMixin.Meta):
|
||||
model = Exam
|
||||
Reference in New Issue
Block a user