summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorparth2012-03-26 04:17:29 +0530
committerparth2012-03-26 04:17:29 +0530
commit3870bda1286a5c3082421a887ee48637b8b6e334 (patch)
tree014f421ab9e189ca7b538653878aa912e7b9bba6
parent64f86257d72d1f3507682f691bb17b49588b6431 (diff)
downloadaloha-3870bda1286a5c3082421a887ee48637b8b6e334.tar.gz
aloha-3870bda1286a5c3082421a887ee48637b8b6e334.tar.bz2
aloha-3870bda1286a5c3082421a887ee48637b8b6e334.zip
made modifications for bootstrap and crispy forms
-rw-r--r--allotter/forms.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/allotter/forms.py b/allotter/forms.py
index 65e4cf6..54210cc 100644
--- a/allotter/forms.py
+++ b/allotter/forms.py
@@ -1,4 +1,3 @@
-
from django import forms
from allotter.models import Profile
from django.forms.extras.widgets import SelectDateWidget
@@ -7,6 +6,8 @@ from django.utils.encoding import *
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
+from crispy_forms.helper import FormHelper
+from crispy_forms.layout import Submit
from string import digits
@@ -24,7 +25,7 @@ class UserLoginForm(forms.Form):
max_length=10, help_text="As on your Examination ID Card")
dob = forms.DateField(label="Date of Birth",
- widget=SelectDateWidget(years=BIRTH_YEAR_CHOICES),
+ widget=SelectDateWidget(years=BIRTH_YEAR_CHOICES, attrs={"class":"span1"}),
initial=datetime.date.today)
def clean_username(self):
@@ -78,6 +79,15 @@ class UserLoginForm(forms.Form):
if not user:
raise forms.ValidationError("Application Number or Registration Number doesn't match.")
return user
+
+ def __init__(self, *args, **kwargs):
+ self.helper = FormHelper()
+ self.helper.form_id = 'id-loginform'
+ self.helper.form_method = 'post'
+ self.helper.form_class = 'form-horizontal'
+ self.helper.form_action = " "
+ self.helper.add_input(Submit('submit', 'Submit'))
+ super(UserLoginForm, self).__init__(*args, **kwargs)
class UserDetailsForm(forms.Form):