summaryrefslogtreecommitdiff
path: root/website/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'website/forms.py')
-rwxr-xr-xwebsite/forms.py38
1 files changed, 31 insertions, 7 deletions
diff --git a/website/forms.py b/website/forms.py
index b6bbc20..9972913 100755
--- a/website/forms.py
+++ b/website/forms.py
@@ -18,6 +18,16 @@ MY_CHOICES = (
('Beginner', 'Beginner'),
('Advanced', 'Advanced'),
)
+
+ws_duration = (
+ ('2', '2'),
+ ('3', '3'),
+ ('4', '4'),
+)
+MY_CHOICES = (
+ ('Beginner', 'Beginner'),
+ ('Advanced', 'Advanced'),
+)
rating=(
('1','1'),
('2','2'),
@@ -65,11 +75,15 @@ class ProposalForm(forms.ModelForm):
)
abstract = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Abstract'}),
required = True,
+ label = 'Abstract (Min. 300 char.)',
error_messages = {'required':'Abstract field required.'},
)
proposal_type = forms.CharField(widget = forms.HiddenInput(), label = '', initial = 'ABSTRACT', required=False)
- tags = forms.ChoiceField(choices=MY_CHOICES)
+ tags = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Tags'}),
+ required = False,
+ )
+
class Meta:
model = Proposal
@@ -89,11 +103,16 @@ class ProposalForm(forms.ModelForm):
ext = os.path.splitext(attachment.name)[1]
valid_extensions = ['.pdf']
if not ext in valid_extensions:
- raise forms.ValidationError(u'File not supported!')
+ raise forms.ValidationError(u'File not supported! Only .pdf file is accepted')
if attachment.size > (5*1024*1024):
raise forms.ValidationError('File size exceeds 5MB')
return attachment
+ # def clean_abstract(self):
+ # about_me = self.cleaned_data['abstract']
+ # if len(about_me) < 300:
+ # raise forms.ValidationError("Abstract me should contain min. 300 characteres")
+
class WorkshopForm(forms.ModelForm):
about_me = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'About Me'}),
@@ -111,7 +130,7 @@ class WorkshopForm(forms.ModelForm):
)
abstract = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Desciption'}),
required = True,
- label = 'Description',
+ label = 'Description (Min. 300 char.)',
error_messages = {'required':'Abstract field required.'},
)
prerequisite = forms.CharField(widget=forms.Textarea(attrs={'class': 'form-control', 'placeholder': 'Prerequisite'}),
@@ -120,9 +139,9 @@ class WorkshopForm(forms.ModelForm):
)
proposal_type = forms.CharField(widget = forms.HiddenInput(), label = '', required=False, initial = 'WORKSHOP')
- tags = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control', 'placeholder': 'Tags'}),
- required = False,
- )
+ duration = forms.ChoiceField(choices=ws_duration, label = 'Duration (Hrs.)')
+
+ tags = forms.ChoiceField(choices=MY_CHOICES)
class Meta:
model = Proposal
@@ -142,11 +161,16 @@ class WorkshopForm(forms.ModelForm):
ext = os.path.splitext(attachment.name)[1]
valid_extensions = ['.pdf',]
if not ext in valid_extensions:
- raise forms.ValidationError(u'File not supported!')
+ raise forms.ValidationError(u'File not supported! Only .pdf file is accepted')
if attachment.size > (5*1024*1024):
raise forms.ValidationError('File size exceeds 5MB')
return attachment
+ def clean_abstract(self):
+ about_me = self.cleaned_data['abstract']
+ if len(about_me) < 300:
+ raise forms.ValidationError("Abstract me should contain min. 300 characteres")
+
class UserRegisterForm(UserCreationForm):
class Meta:
model = User