Advertisement
Guest User

Untitled

a guest
Aug 28th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.40 KB | None | 0 0
  1. class SignUp(models.Model):
  2. customer_name=models.CharField(max_length=100,blank=False, primary_key=True)
  3. customer_website_url=models.CharField(max_length=200, blank=True)
  4. account_manager_email = models.EmailField(blank=False)
  5. customer_uuid= models.CharField(max_length = 32)
  6. timestamp = models.DateTimeField(auto_now_add=True, auto_now=False)
  7. def __unicode__(self):
  8.  
  9. return self.customer_uuid
  10.  
  11. class SignUpForm(models.ModelForm):
  12. class Meta:
  13. model= SignUp
  14. fields=['customer_name',
  15. 'customer_website_url',
  16. 'account_manager_email',
  17. ]
  18.  
  19. def clean_account_manager_email(self):
  20. account_manager_email = self.cleaned_data.get('account_manager_email')
  21. if not "google" in account_manager_email:
  22. raise forms.ValidationError("Please use a valid email address")
  23. return account_manager_email
  24.  
  25.  
  26.  
  27. def __init__ (self, *args, **kwargs):
  28. super(SignUpForm, self).__init__(self, *args, **kwargs)
  29. self.uuid = random_uuid = uuid.uuid4().hex
  30.  
  31.  
  32.  
  33. def save(self, commit=True):
  34. signup = super(SignUpForm,self).save(commit = False)
  35. signup.customer_uuid = self.uuid
  36. signup.save()
  37. return signup
  38.  
  39. File "/Library/Python/2.7/site-packages/Django-1.8.3-py2.7.egg/django/core/handlers/base.py" in get_response
  40. 132. response = wrapped_callback(request, *callback_args, **callback_kwargs)
  41.  
  42. File "/Users/user/Documents/work/src/info/views.py" in home
  43. 32. if form.is_valid():
  44.  
  45. File "/Library/Python/2.7/site-packages/Django-1.8.3-py2.7.egg/django/forms/forms.py" in is_valid
  46. 184. return self.is_bound and not self.errors
  47.  
  48. File "/Library/Python/2.7/site-packages/Django-1.8.3-py2.7.egg/django/forms/forms.py" in errors
  49. 176. self.full_clean()
  50.  
  51. File "/Library/Python/2.7/site-packages/Django-1.8.3-py2.7.egg/django/forms/forms.py" in full_clean
  52. 392. self._clean_fields()
  53.  
  54. File "/Library/Python/2.7/site-packages/Django-1.8.3-py2.7.egg/django/forms/forms.py" in _clean_fields
  55. 401. value = field.widget.value_from_datadict(self.data, self.files, self.add_prefix(name))
  56.  
  57. File "/Library/Python/2.7/site-packages/Django-1.8.3-py2.7.egg/django/forms/widgets.py" in value_from_datadict
  58. 223. return data.get(name, None)
  59.  
  60. Exception Type: AttributeError at /
  61.  
  62. Exception Value: 'SignUpForm' object has no attribute 'get'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement