diff options
author | Prabhu Ramachandran | 2016-04-26 17:15:31 +0530 |
---|---|---|
committer | Prabhu Ramachandran | 2016-04-26 17:15:31 +0530 |
commit | 825f8464ef1b2853c029cc23bf7fb89f6a9c1c09 (patch) | |
tree | 0b94516d5a969dce5bc0750e405ca45850880f21 /yaksh/forms.py | |
parent | 97bdb23fbacc3e625beb96efdf58431f42604a81 (diff) | |
parent | 3be13f4868a881cbe591e9eb686872875272ac1d (diff) | |
download | online_test-825f8464ef1b2853c029cc23bf7fb89f6a9c1c09.tar.gz online_test-825f8464ef1b2853c029cc23bf7fb89f6a9c1c09.tar.bz2 online_test-825f8464ef1b2853c029cc23bf7fb89f6a9c1c09.zip |
Merge pull request #89 from adityacp/Editprofile
Profile change, Enroll students and change password
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 84cf1c4..681eca0 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -140,7 +140,6 @@ class QuizForm(forms.ModelForm): self.fields['course'] = forms.ModelChoiceField( queryset=Course.objects.filter(creator=user)) - class Meta: model = Quiz fields = '__all__' @@ -187,3 +186,21 @@ class CourseForm(forms.ModelForm): class Meta: model = Course fields = ['name', 'active', 'enrollment'] + +class ProfileForm(forms.ModelForm): + """ profile form for students and moderators """ + + class Meta: + model = Profile + fields = ['first_name', 'last_name', 'institute', + 'department', 'roll_number', 'position'] + + first_name = forms.CharField(max_length=30) + last_name = forms.CharField(max_length=30) + + def __init__(self, *args, **kwargs): + if 'user' in kwargs: + user = kwargs.pop('user') + super(ProfileForm, self).__init__(*args, **kwargs) + self.fields['first_name'].initial = user.first_name + self.fields['last_name'].initial = user.last_name |