Advertisement
Guest User

Untitled

a guest
Oct 5th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. from django import forms
  2. from django.contrib.auth.models import User
  3. from Box.models import user_files
  4.  
  5.  
  6. class Loginform(forms.Form):
  7. username=forms.CharField(max_length=50)
  8. password=forms.CharField(widget=forms.PasswordInput)
  9.  
  10. class UserRegistration(forms.ModelForm):
  11. password = forms.CharField(label='Password',widget=forms.PasswordInput)
  12. password2 = forms.CharField(label='Repeat Password',widget=forms.PasswordInput)
  13.  
  14. class Meta:
  15. model=User
  16. fields= ('username','first_name','email')
  17.  
  18. def clean_password2(self):
  19. cd=self.cleaned_data
  20. if cd['password']!=cd['password2']:
  21. raise forms.ValidationError('Passwords do not match')
  22. return cd['password2']
  23.  
  24. class Fileupload(forms.ModelForm):
  25. class Meta:
  26. model= user_files
  27. fields = ('Filename','Browse')
  28.  
  29. class user_files(models.Model):
  30. Filename = models.CharField(max_length=50)
  31. Browse = models.FileField()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement