.
This commit is contained in:
+16
-11
@@ -8,7 +8,7 @@ from django.forms import (
|
||||
)
|
||||
from django.forms import inlineformset_factory
|
||||
|
||||
from generic.forms import ExamFormMixin
|
||||
from generic.forms import ExamAuthorFormMixin, ExamFormMixin
|
||||
|
||||
from .models import (
|
||||
Answer,
|
||||
@@ -207,14 +207,19 @@ class ExamForm(ExamFormMixin, ModelForm):
|
||||
class Meta(ExamFormMixin.Meta):
|
||||
model = Exam
|
||||
|
||||
class ExamAuthorForm(ModelForm):
|
||||
class Meta:
|
||||
model = Exam
|
||||
fields = ["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),
|
||||
# )
|
||||
|
||||
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