Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django import forms
- from django.contrib.auth.models import User
- from Box.models import user_files
- class Loginform(forms.Form):
- username=forms.CharField(max_length=50)
- password=forms.CharField(widget=forms.PasswordInput)
- class UserRegistration(forms.ModelForm):
- password = forms.CharField(label='Password',widget=forms.PasswordInput)
- password2 = forms.CharField(label='Repeat Password',widget=forms.PasswordInput)
- class Meta:
- model=User
- fields= ('username','first_name','email')
- def clean_password2(self):
- cd=self.cleaned_data
- if cd['password']!=cd['password2']:
- raise forms.ValidationError('Passwords do not match')
- return cd['password2']
- class Fileupload(forms.ModelForm):
- class Meta:
- model= user_files
- fields = ('Filename','Browse')
- class user_files(models.Model):
- Filename = models.CharField(max_length=50)
- Browse = models.FileField()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement