.
This commit is contained in:
+3
-8
@@ -107,14 +107,7 @@ class LongForm(ModelForm):
|
|||||||
js = ["jsi18n.js", "tesseract.min.js"]
|
js = ["jsi18n.js", "tesseract.min.js"]
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(LongForm, self).__init__(*args, **kwargs)
|
self.user = kwargs.pop('user') # To get request.user. Do not use kwargs.pop('user', None) due to potential security hole
|
||||||
# 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),
|
|
||||||
#)
|
|
||||||
|
|
||||||
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
|
||||||
# as a dict if it didn't exist.
|
# as a dict if it didn't exist.
|
||||||
@@ -125,6 +118,8 @@ class LongForm(ModelForm):
|
|||||||
|
|
||||||
ModelForm.__init__(self, *args, **kwargs)
|
ModelForm.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
|
super(LongForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
if self.user.groups.filter(name="long_checker").exists():
|
if self.user.groups.filter(name="long_checker").exists():
|
||||||
exam_queryset = Exam.objects.all()
|
exam_queryset = Exam.objects.all()
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user