diff options
author | adityacp | 2016-03-23 11:14:47 +0530 |
---|---|---|
committer | adityacp | 2016-04-15 13:57:44 +0530 |
commit | 234cf831861045796a7bcf4e08a46b0c38016f75 (patch) | |
tree | 4af3e5a066b3aee420d60eef4fcc5e7a67fdc037 /yaksh/forms.py | |
parent | 97bdb23fbacc3e625beb96efdf58431f42604a81 (diff) | |
download | online_test-234cf831861045796a7bcf4e08a46b0c38016f75.tar.gz online_test-234cf831861045796a7bcf4e08a46b0c38016f75.tar.bz2 online_test-234cf831861045796a7bcf4e08a46b0c38016f75.zip |
EditProfile, ChangePassword, StudentsEnrollment facility
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r-- | yaksh/forms.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py index 84cf1c4..f4d1b02 100644 --- a/yaksh/forms.py +++ b/yaksh/forms.py @@ -187,3 +187,27 @@ class CourseForm(forms.ModelForm): class Meta: model = Course fields = ['name', 'active', 'enrollment'] + +class EditProfile(forms.Form): + """ edit profile form for students and moderators """ + + first_name = forms.CharField(max_length=30) + last_name = forms.CharField(max_length=30) + institute = forms.CharField\ + (max_length=128) + department = forms.CharField\ + (max_length=64) + roll_number = forms.CharField\ + (max_length=30) + position = forms.CharField\ + (max_length=64) + + def save(self, user): + user.first_name = self.cleaned_data['first_name'] + user.last_name = self.cleaned_data['last_name'] + user.profile.department = self.cleaned_data['department'] + user.profile.institute = self.cleaned_data['institute'] + user.profile.roll_number = self.cleaned_data['roll_number'] + user.profile.position = self.cleaned_data['position'] + user.save() + user.profile.save() |