-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.txt
72 lines (59 loc) · 2.83 KB
/
models.txt
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
from django.contrib.auth.models import AbstractUser
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
# Overriding the Default Django Auth User and adding One More Field
class User(AbstractUser):
phone = models.CharField(max_length=15,blank=True,null=True)
gender = models.CharField(max_length=10,blank=True,null=True)
image = models.ImageField(upload_to='user_profile',blank=True,null=True)
session_key = models.CharField(max_length=255,blank=True,null=True)
def __str__(self):
return self.email
class customer(models.Model):
name = models.CharField(max_length=50)
email = models.EmailField(max_length=255,blank=True,null=True) # Email is optional
address = models.CharField(max_length=100, blank=True, null=True)
phone = models.CharField(max_length=10) # Phone No is compulasary
gender = models.CharField(max_length=10,blank=True,null=True)
image = models.ImageField(upload_to='profile/buyer', blank=True, null=True)
remark = models.TextField(blank=True, null=True)
def __str__(self):
return self.name
## Veg and Non-veg
class category(models.Model):
category = models.CharField(max_length=50)
sub_category = models.CharField(max_length=50, blank=True, null=True)
def __str__(self):
return str(self.category)
## Indian | Italian | Chinese | Maxican
class cuisine(models.Model):
name = models.CharField(max_length=50)
sub_name = models.CharField(max_length=50, blank=True, null=True)
def __str__(self):
return str(self.name)
class food(models.Model):
name = models.CharField(max_length=100)
unit_price = models.FloatField()
food_category = models.CharField(max_length=50,blank=True,null=True)
food_cuisine = models.CharField(max_length=50,blank=True,null=True)
ingredients = models.TextField(blank=True,null=True)
description = models.TextField(blank=True,null=True)
def __str__(self):
return self.name
class order(models.Model):
invoice_id = models.CharField(max_length=10)
order_date = models.DateTimeField()
customer = models.ForeignKey(customer, on_delete=models.CASCADE)
number_of_items = models.IntegerField()
total_gst = models.FloatField()
grand_amount = models.FloatField()
payment_type = models.CharField(max_length=50)
class order_item(models.Model):
order = models.ForeignKey(order, on_delete=models.CASCADE)
food = models.ForeignKey(food, on_delete=models.CASCADE)
quantity = models.IntegerField(blank=False,null=False)
price = models.FloatField(blank=False,null=False)
discount = models.FloatField(blank=False,null=False)
discount_amount = models.FloatField(blank=False,null=False)
total_amount = models.FloatField(blank=False,null=False)