.
This commit is contained in:
+3
-8
@@ -107,14 +107,7 @@ class LongForm(ModelForm):
|
||||
js = ["jsi18n.js", "tesseract.min.js"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(LongForm, self).__init__(*args, **kwargs)
|
||||
# self.fields['question'].widget.attrs = {'class': 'question-form', 'rows': 10, 'cols': 100}
|
||||
# self.fields['feedback'].widget.attrs = {'class': 'feedback-form', 'rows': 10, 'cols': 100}
|
||||
#self.fields["examination"] = ModelMultipleChoiceField(
|
||||
# queryset=Examination.objects.all(),
|
||||
# widget=FilteredSelectMultiple(verbose_name="Examination", is_stacked=False),
|
||||
#)
|
||||
|
||||
self.user = kwargs.pop('user') # To get request.user. Do not use kwargs.pop('user', None) due to potential security hole
|
||||
if kwargs.get("instance"):
|
||||
# We get the 'initial' keyword argument or initialize it
|
||||
# as a dict if it didn't exist.
|
||||
@@ -125,6 +118,8 @@ class LongForm(ModelForm):
|
||||
|
||||
ModelForm.__init__(self, *args, **kwargs)
|
||||
|
||||
super(LongForm, self).__init__(*args, **kwargs)
|
||||
|
||||
if self.user.groups.filter(name="long_checker").exists():
|
||||
exam_queryset = Exam.objects.all()
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user