diff options
author | adityacp | 2016-04-15 11:40:25 +0530 |
---|---|---|
committer | adityacp | 2016-05-04 22:47:34 +0530 |
commit | d53feb82cdd74e25045171acf70e513729ba993c (patch) | |
tree | 70af917cb9909adea89367461ca8c6212b7440df /yaksh/forms.py | |
parent | 8841e5ed4f8f79b7067ddb3523f4a3ec50f362b3 (diff) | |
download | online_test-d53feb82cdd74e25045171acf70e513729ba993c.tar.gz online_test-d53feb82cdd74e25045171acf70e513729ba993c.tar.bz2 online_test-d53feb82cdd74e25045171acf70e513729ba993c.zip |
rebase changes
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 16f82fb..37741b9 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -152,7 +152,7 @@ class QuestionForm(forms.ModelForm): class Meta: model = Question - fields = '__all__' + exclude = ['user'] class RandomQuestionForm(forms.Form): @@ -165,8 +165,9 @@ class RandomQuestionForm(forms.Form): class QuestionFilterForm(forms.Form): def __init__(self, *args, **kwargs): + user = kwargs.pop("user") super(QuestionFilterForm, self).__init__(*args, **kwargs) - questions = Question.objects.all() + questions = Question.objects.filter(user_id=user) points_list = questions.values_list('points', flat=True).distinct() points_options = [('select', 'Select Marks')] points_options.extend([(point, point) for point in points_list]) @@ -188,6 +189,7 @@ class CourseForm(forms.ModelForm): model = Course fields = ['name', 'active', 'enrollment'] + class ProfileForm(forms.ModelForm): """ profile form for students and moderators """ @@ -205,3 +207,8 @@ class ProfileForm(forms.ModelForm): super(ProfileForm, self).__init__(*args, **kwargs) self.fields['first_name'].initial = user.first_name self.fields['last_name'].initial = user.last_name + + +class UploadFileForm(forms.Form): + file = forms.FileField() + |