-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.py
66 lines (57 loc) · 2.35 KB
/
models.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
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Driver(models.Model):
# name=models.CharField(max_length=255)
# email=models.EmailField(max_length=255)
# phone=models.CharField(max_length=255)
# LOCATION=(
# ('Kuniyamuthur','Kuniyamuthur'),
# ('Ukkadam','Ukkadam'),
# ('Gandhipuram','Gandhipuram'),
# ('Sundharapuram','Sundharapuram'),
# )
# Location=models.CharField(max_length=255,choices = LOCATION)
# lic_no=models.IntegerField()
# vehicle_no=models.CharField(max_length=255)
# password=models.CharField(max_length=50)
user=models.OneToOneField(User,on_delete=models.CASCADE,null=True)
# user_id=models.CharField(max_length=10,null=True)
# name=models.CharField(max_length=200,null=True)
# email=models.EmailField(max_length=255,null=True)
phone=models.CharField(max_length=255,null=True,blank=True)
LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
Location=models.CharField(max_length=255,choices = LOCATION,null=True)
lic_no=models.IntegerField(null=True,blank=True)
vehicle_no=models.CharField(max_length=255,null=True,blank=True)
# date_created = models.DateTimeField(auto_now_add=True, null=True)
# def user(self):
# return User.objects.get(pk=self.user_id)
def __str__(request):
return str(request.user)
class Booking(models.Model):
name=models.CharField(max_length=255,null=True)
email=models.EmailField(max_length=255,null=True)
phone=models.CharField(max_length=20,null=True)
passenger=models.IntegerField(null=True)
FROM_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
StartLocation=models.CharField(max_length=255,null=True,choices = FROM_LOCATION)
TO_LOCATION=(
('Kuniyamuthur','Kuniyamuthur'),
('Ukkadam','Ukkadam'),
('Gandhipuram','Gandhipuram'),
('Sundharapuram','Sundharapuram'),
)
ToLocation=models.CharField(max_length=255,null=True,choices = TO_LOCATION)
def __str__(self):
return self.name