summaryrefslogtreecommitdiff
path: root/yaksh/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'yaksh/forms.py')
-rw-r--r--yaksh/forms.py24
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()