Example #1
0
 def clean_phone(self):
     self.cleaned_data['phone'] = intl_clean_phone_number(self.cleaned_data['phone'])
     if self.edit_user and self.edit_user.get_profile():
         check_for_dupes(self.cleaned_data['phone'], self.edit_user.get_profile().contact)
     else: 
         check_for_dupes(self.cleaned_data['phone'])
     return self.cleaned_data['phone']
Example #2
0
 def save(self, *args, **kwargs):
     new_user = super(EWSGhanaSelfRegistrationForm,
                      self).save(*args, **kwargs)
     profile = new_user.get_profile()
     if 'designation' in self.cleaned_data and self.cleaned_data[
             'designation']:
         profile = new_user.get_profile()
         profile.designation = self.cleaned_data['designation']
     if 'organization' in self.cleaned_data:
         profile.organization = self.cleaned_data['organization']
     if 'first_name' in self.cleaned_data:
         new_user.first_name = self.cleaned_data['first_name']
     if 'last_name' in self.cleaned_data:
         new_user.last_name = self.cleaned_data['last_name']
     if 'phone' in self.cleaned_data and self.cleaned_data['phone']:
         phone_number = intl_clean_phone_number(self.cleaned_data['phone'])
         profile.get_or_create_contact().set_default_connection_identity(
             phone_number, backend_name=settings.DEFAULT_BACKEND)
     else:
         contact = profile.contact
         if contact and contact.default_connection:
             contact.default_connection.delete()
     profile.save()
     new_user.save()
     return new_user
Example #3
0
 def clean_phone(self):
     self.cleaned_data['phone'] = intl_clean_phone_number(
         self.cleaned_data['phone'])
     if self.edit_user and self.edit_user.get_profile():
         check_for_dupes(self.cleaned_data['phone'],
                         self.edit_user.get_profile().contact)
     else:
         check_for_dupes(self.cleaned_data['phone'])
     return self.cleaned_data['phone']
Example #4
0
 def save(self, *args, **kwargs):
     user = super(EWSGhanaBasicWebRegistrationForm, self).save(*args, **kwargs)
     profile = user.get_profile()
     if 'organization' in self.cleaned_data:
         profile.organization = self.cleaned_data['organization']
     if 'first_name' in self.cleaned_data:
         user.first_name = self.cleaned_data['first_name']
     if 'last_name' in self.cleaned_data:
         user.last_name = self.cleaned_data['last_name']
     if 'phone' in self.cleaned_data and self.cleaned_data['phone']:
         phone_number = intl_clean_phone_number(self.cleaned_data['phone'])
         profile.get_or_create_contact().set_default_connection_identity(phone_number, backend_name=settings.DEFAULT_BACKEND)
     else:
         contact = profile.contact
         if contact and contact.default_connection:
             contact.default_connection.delete()
     profile.save()
     user.save()
     return user
Example #5
0
 def _clean_phone_number(self, phone_number):
     return intl_clean_phone_number(phone_number)
Example #6
0
 def _clean_phone_number(self, phone_number):
     return intl_clean_phone_number(phone_number)
Example #7
0
 def clean_phone(self):
     self.cleaned_data['phone'] = intl_clean_phone_number(self.cleaned_data['phone'])
     check_for_dupes(self.cleaned_data['phone'])
     return self.cleaned_data['phone']
Example #8
0
 def clean_phone(self):
     self.cleaned_data['phone'] = intl_clean_phone_number(
         self.cleaned_data['phone'])
     check_for_dupes(self.cleaned_data['phone'])
     return self.cleaned_data['phone']