0% found this document useful (0 votes)
208 views3 pages

Ecommerce Website Using Django.: Project in Python

The document describes models created for an ecommerce website using Django. It includes models for addresses, orders, order line items, queries, and products. The address, order, and order line item models store information for user addresses, order information like name and address, and details of individual items ordered. The query model stores contact queries. The product model defines fields for product name, description, price, and image.

Uploaded by

programmer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
208 views3 pages

Ecommerce Website Using Django.: Project in Python

The document describes models created for an ecommerce website using Django. It includes models for addresses, orders, order line items, queries, and products. The address, order, and order line item models store information for user addresses, order information like name and address, and details of individual items ordered. The query model stores contact queries. The product model defines fields for product name, description, price, and image.

Uploaded by

programmer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

CE376: PROGRAMMING IN PYTHON (Elective-II) 16CE068

PROJECT IN PYTHON
Ecommerce Website using Django.
a)Model address:

from [Link] import models

from [Link] import User

from [Link] import reverse

# Create your models here.

class Address([Link]):

user_id=[Link](User, null=False,on_delete=[Link])

full_name = [Link](max_length=50, blank=False)

phone_number = [Link](max_length=20, blank=False)

country = [Link](max_length=40, blank=False)

postcode = [Link](max_length=20, blank=True)

town_or_city = [Link](max_length=40, blank=False)

street_address_1 = [Link](max_length=40, blank=False)

street_address_2 = [Link](max_length=40, blank=False)

county = [Link](max_length=40, blank=False)

b)model order:

from [Link] import models

from [Link] import Product

class Order([Link]):

full_name = [Link](max_length=50, blank=False)

phone_number = [Link](max_length=20, blank=False)

55
CE376: PROGRAMMING IN PYTHON (Elective-II) 16CE068

country = [Link](max_length=40, blank=False)

postcode = [Link](max_length=20, blank=True)

town_or_city = [Link](max_length=40, blank=False)

street_address_1 = [Link](max_length=40, blank=False)

street_address_2 = [Link](max_length=40, blank=False)

county = [Link](max_length=40, blank=False)

date = [Link]()

def __str__(self):

return "{0}-{1}-{2}".format([Link], [Link], self.full_name)

class OrderLineItem([Link]):

order = [Link](Order, null=False,on_delete=[Link])

product = [Link](Product, null=False,on_delete=[Link])

quantity = [Link](blank=False)

def __str__(self):

return "{0} {1} @ {2}".format([Link], [Link], [Link])

c)model query:

from [Link] import models

# Create your models here.

class Query([Link]):

fullname=[Link](max_length=200)

email=[Link]()

content=[Link]()

56
CE376: PROGRAMMING IN PYTHON (Elective-II) 16CE068

def __str__(self):

return [Link]

d)model product

from [Link] import models

class Product([Link]):

name = [Link](max_length=254, default='')

description = [Link]()

price = [Link](max_digits=10, decimal_places=2)

image = [Link](upload_to='images')

def __str__(self):

return str([Link])

57

You might also like