-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
114 lines (85 loc) · 2.77 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
from django.contrib.auth.models import User
from django import forms
from .models import Booking,Driver
FROM_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
TO_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
class BookingForm(forms.ModelForm):
name=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Your name',
}))
email=forms.EmailField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Email address',
'type':'email',
}))
phone=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control ',
'placeholder':'Phone Number',
}))
passenger=forms.IntegerField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Passenger Count',
'type':'number',
}))
StartLocation = forms.ChoiceField(choices=FROM_LOCATION,required=True)
ToLocation = forms.ChoiceField(choices=TO_LOCATION,required=True)
class Meta:
model=Booking
fields=['name','email','phone','StartLocation','ToLocation','passenger']
class UserForm(forms.ModelForm):
username=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Your name',
}))
email=forms.EmailField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'Email address',
'type':'email',
}))
password=forms.CharField(widget=forms.PasswordInput(attrs={
'class':'form-control',
'placeholder':'Enter the password',
}))
class Meta:
model=User
fields=('username','email','password')
class Driverform(forms.ModelForm):
# name=forms.CharField(widget=forms.TextInput(attrs={
# 'class':'form-control',
# 'placeholder':'Your name',
#
# }))
phone=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control ',
'placeholder':'Phone Number'
}))
lic_no=forms.IntegerField(widget=forms.TextInput(attrs={
'class':'form-control',
'placeholder':'License Number',
'type':'number',
}))
vehicle_no=forms.CharField(widget=forms.TextInput(attrs={
'class':'form-control ',
'placeholder':'Vehicle No',
}))
Location = forms.ChoiceField(choices=LOCATION,required=True)
class Meta:
model=Driver
fields=['phone','lic_no','vehicle_no','Location']