-
Notifications
You must be signed in to change notification settings - Fork 13
/
models.py
51 lines (40 loc) · 1.58 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
# Create your models here.
from django.db import models
# Create your models here.
class Bus(models.Model):
bus_name = models.CharField(max_length=30)
source = models.CharField(max_length=30)
dest = models.CharField(max_length=30)
nos = models.DecimalField(decimal_places=0, max_digits=2)
rem = models.DecimalField(decimal_places=0, max_digits=2)
price = models.DecimalField(decimal_places=2, max_digits=6)
date = models.DateField()
time = models.TimeField()
def __str__(self):
return self.bus_name
class User(models.Model):
user_id = models.AutoField(primary_key=True)
email = models.EmailField()
name = models.CharField(max_length=30)
password = models.CharField(max_length=30)
def __str__(self):
return self.email
class Book(models.Model):
BOOKED = 'B'
CANCELLED = 'C'
TICKET_STATUSES = ((BOOKED, 'Booked'),
(CANCELLED, 'Cancelled'),)
email = models.EmailField()
name = models.CharField(max_length=30)
userid =models.DecimalField(decimal_places=0, max_digits=2)
busid=models.DecimalField(decimal_places=0, max_digits=2)
bus_name = models.CharField(max_length=30)
source = models.CharField(max_length=30)
dest = models.CharField(max_length=30)
nos = models.DecimalField(decimal_places=0, max_digits=2)
price = models.DecimalField(decimal_places=2, max_digits=6)
date = models.DateField()
time = models.TimeField()
status = models.CharField(choices=TICKET_STATUSES, default=BOOKED, max_length=255)
def __str__(self):
return self.email