.
This commit is contained in:
+16
-11
@@ -8,7 +8,7 @@ from django.forms import (
|
|||||||
)
|
)
|
||||||
from django.forms import inlineformset_factory
|
from django.forms import inlineformset_factory
|
||||||
|
|
||||||
from generic.forms import ExamFormMixin
|
from generic.forms import ExamAuthorFormMixin, ExamFormMixin
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Answer,
|
Answer,
|
||||||
@@ -207,14 +207,19 @@ class ExamForm(ExamFormMixin, ModelForm):
|
|||||||
class Meta(ExamFormMixin.Meta):
|
class Meta(ExamFormMixin.Meta):
|
||||||
model = Exam
|
model = Exam
|
||||||
|
|
||||||
class ExamAuthorForm(ModelForm):
|
#class ExamAuthorForm(ModelForm):
|
||||||
class Meta:
|
# class Meta:
|
||||||
model = Exam
|
# model = Exam
|
||||||
fields = ["author"]
|
# 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)
|
class ExamAuthorForm(ExamAuthorFormMixin):
|
||||||
self.fields["author"] = ModelMultipleChoiceField(
|
class Meta(ExamAuthorFormMixin.Meta):
|
||||||
queryset=User.objects.all(),
|
model = Exam
|
||||||
widget=FilteredSelectMultiple(verbose_name="Authors", is_stacked=False),
|
|
||||||
)
|
|
||||||
Reference in New Issue
Block a user