21
22
'aim', 'yahoo', 'signature', 'email', 'show_signatures',
22
23
'time_zone', 'time_display', ]
25
25
def __init__(self, *args, **kwargs):
26
instance = kwargs.pop("instance")
26
instance = kwargs.pop('instance')
28
super(EditProfileForm, self).__init__(instance=instance, *args,**kwargs)
28
super(EditProfileForm, self).__init__(
29
instance=instance, *args, **kwargs)
30
31
self.fields['email'].initial = instance.user.email
32
33
def clean_signature(self):
33
34
value = self.cleaned_data['signature'].strip()
34
35
if len(re.findall(r'\n', value)) > settings.SIGNATURE_MAX_LINES:
35
raise forms.ValidationError('Number of lines is limited to %d' % settings.SIGNATURE_MAX_LINES)
36
raise forms.ValidationError(
37
'Number of lines is limited to %d' % settings.SIGNATURE_MAX_LINES)
36
38
if len(value) > settings.SIGNATURE_MAX_LENGTH:
37
raise forms.ValidationError('Length of signature is limited to %d' % settings.SIGNATURE_MAX_LENGTH)
39
raise forms.ValidationError(
40
'Length of signature is limited to %d' % settings.SIGNATURE_MAX_LENGTH)
40
43
def save(self, *args, **kwargs):