E Commerce
E Commerce
E Commerce
SEA of A
project
Computer
Devasandra College Department BACHELOR report
College
Ekta Application,
submitted
Nagar, Under during
Mai
University
Bengaluru
n North of of Amaljith m of
"E-Conmerce
Website"
Bangalore-560049.Road, Science,
Near KowLEDGE
Computer
L.SASIKALA SubmittedBy OF the sixth in
Science,
ASIST
AN the partial
COMPUTERacademic
Ayyappanagar
Vigronagar semester
SEAET Guidance
SUPRE13 EDUGATIO fulfillment
QUALIT Science
Commerce EoUCATION TRUSTR)
HROUGA yearunder
Post, R2013408 2022-2023.
Commerce
Circle, & APPLICATIONS
of Bengaluru the of
K.R.Puram, Applications
requirement
and
North
Arts
University for and
bachelor
Arts
a of in Computer Place:
Bangalore
is is
guidance Department Date:
O6-||-2023
Website",
which
Arts
of
Applications,
and of Bachelor
"E-Commerce
University
North
Bengaluru Under the
Commerce 2022-2023. of
of
(R2013408) A.
award Head & Circle,
&
HROUGH
aUALITY
DUCATE
ASIAN
ON
PREY
Certificate
Science
entitled
theUniversity
Commerce
Puram,
Nagar Bangalore
Principal
PRINCIPAL -560
049
K.R.
Science,
Ayyappa
Post,
Science, SEAE Computer
for
m
project Virgonagar
requirement
Amaljith of Ekthanagar,
sOUTHEA North College
the of SEA
of Bengaluru
that Department
by the
College certify
done of
fulfillment
from
to workL.SASIKALA
Guide VALUED
Internal RECORD
is Application Examiners:
SEA This
Bonfied
partial 1)
functioning support,
strength Asian Arts And
constant not
and
and prayers.
if
well-being
and East order. constant advices the
proper Commerce project.
her
project.South
knowledge, proper and
in
helped
for her
her Professor advice
of the this for our
this chairman
for Science,
in for gratitude for which
completeequipment'sruns UGof
wisdom, completion encouragement,
also
everythingof Assistant advice
of but
Acknowledgment
health,
the
and Krishnappa,
College
Department
sincere
studies and
adequate successful
,
start that L.Sasikala
our
blessings. SEA support, support
to sure the express our
able A. and of of
for
their
making
Principal
Lateinfrastructure the
Head only
guidance,
the are Mrs.
to We for
forwe contributed not
Almighty
the College the guideproject. need, sisters
that to the Theja, their
will gratitude N, our whole and
good T the for we project.
Santhito
greatly materials
Godhis providingGowda managing thanks
the
parents today. brothers
by sincere
thankonly P. which during here this
Muthe
Mrs. hearty our the ourof
to is our for in guidancesupport thank
be
all not thank completion
wantItus. express
Trust Dr.
effort thank our providing
institution.
the
of extend to will to
we to hanktireless
all,
given to Educational and andcorrections.
sincerely want we want
wish also alsoguidance alsofor them. also
Successful
Above
has his advice,
he We We for We We We also,for We
Contents
1. Abstract 5
2. Introduction 5
3. System Specification 7
4. Details of Software 8
6. Modules 17
7. System Design 18
8. Database Design 25
9. Testing 28
10. Coding 30
ABSTRACT
The E-commerce website enables shoppers to place orders for products and services through an online
platform. This platform serves both in-store customers and online shoppers. The website displays a
comprehensive list of items available for purchase from the store. Through this online application, customers
can conveniently select their desired products and provide their personal information such as address and
contact details. The chosen products are then delivered to the customers' homes. Customers have the flexibility
to view their shopping cart anytime, and they can add, modify, or remove items as they prefer.
When a customer decides to finalize their purchase, they have the option to print a copy of their
shopping cart as a record. This web-based application offers significant time-saving benefits to customers and
enhances their overall shopping experience. The field of E-commerce has experienced substantial growth in
the last ten years. An important aspect of online retail is to provide relevant suggestions to users, streamlining
their decision-making process and reducing the time spent on browsing the website. Additionally, the ability
to create visual wishlists and reports adds to the appeal of these online platforms
INTRODUCTION
In the contemporary digital landscape, E-commerce websites have emerged as game-changers,
reshaping the way commerce is conducted. These online platforms have transcended geographical boundaries
and time constraints, allowing individuals and businesses to engage in buying and selling with unprecedented
ease and convenience.
At its core, an E-commerce website serves as a virtual marketplace where products and services of various
types are displayed, categorized, and made available for purchase. This digital storefront provides an extensive
catalog that spans industries, from electronics and fashion to groceries and digital services. Users can explore
a diverse range of options, compare prices, read reviews, and make informed purchasing decisions, all through
a user-friendly interface.
What truly sets E-commerce websites apart is their ability to bridge the gap between buyers and sellers,
regardless of their physical location. This global connectivity has democratized commerce, enabling even the
smallest of businesses to showcase their offerings to a worldwide audience. Moreover, consumers can shop at
any time of day or night, making transactions at their convenience and eliminating the need to adhere to
traditional store operating hours.
The impact of E-commerce websites extends far beyond convenience. For businesses, these platforms
represent a powerful avenue for growth. They can establish an online presence with significantly lower
overhead costs compared to physical stores. This reduced cost structure can lead to competitive pricing for
consumers and increased profit margins for businesses.
In the realm of consumer behavior, E-commerce websites have contributed to a paradigm shift.
Shoppers now possess the ability to research, compare, and purchase items with unparalleled convenience.
This has
E-Commerce Website 5
SEA College Of Science, Commerce and Art’s
led to changes in traditional retail dynamics, prompting businesses to adapt and innovate to meet the evolving
demands of the digital-savvy consumer.
In conclusion, E-commerce websites have ushered in a new era of commerce, where borders are no
longer barriers and transactions occur at the speed of a click. These platforms have transformed the way
businesses operate and the way consumers shop, offering a dynamic and interconnected marketplace that
continues to reshape industries and shape the future of commerce.
DESCRIPTION
An E-commerce website is an online platform that revolutionizes the way businesses and consumers engage
in commerce. It acts as a virtual marketplace where businesses showcase their products and services, and
customers can explore, select, and purchase items with ease. These websites offer a dynamic shopping
experience, featuring user-friendly interfaces, comprehensive product details, secure payment options, and
convenient checkout processes. They enable users to create personalized accounts, track orders, and receive
tailored recommendations based on their preferences. E-commerce websites have reshaped the retail landscape
by providing a borderless, 24/7 shopping environment that caters to a global audience, making transactions
more accessible and efficient than ever before.
PURPOSE
An E-commerce website attempts to enhance admittance to care and improve the continuousness and
good organization of services. Depending on the particular setting and local case executives are responsible
for a diversity of tasks, position from linking clients to the services to really providing intensive shop and
delivery facilities themselves.
MAIN OBJECTIVES
• Facilitate Online Transactions: E-commerce websites are designed to enable smooth and secure
online transactions, allowing customers to browse, select, and purchase products or services with ease.
• Expand Market Reach: The digital nature of E-commerce websites breaks down geographical
barriers, enabling businesses to reach a wider audience beyond their physical location and tap into
global markets.
• Enhance Convenience: E-commerce websites offer the convenience of 24/7 shopping, allowing
customers to browse and buy products at their preferred times, fitting seamlessly into their schedules.
• Provide Product Information: E-commerce platforms present detailed product information, images,
specifications, and customer reviews, empowering customers to make informed purchasing decisions.
E-Commerce Website 6
SEA College Of Science, Commerce and Art’s
• Secure Payment Processing: E-commerce websites prioritize secure payment gateways, protecting
sensitive financial information and instilling customer trust in online transactions.
• Build Customer Relationships: Through user accounts, order history, and personalized
communication, E-commerce websites foster customer loyalty and engagement, leading to long-term
relationships.
• Boost Sales and Revenue: E-commerce platforms offer businesses the potential to increase sales and
revenue by providing a new channel for customer acquisition and driving more frequent transactions.
• Monitor Performance: E-commerce websites enable businesses to track sales metrics, user behavior,
and website performance, allowing them to refine strategies and make data-driven decisions.
• Adapt to Changing Trends: E-commerce websites can quickly adapt to changing market trends,
incorporating new products or services and adjusting strategies to align with consumer preferences.
• Improve User Experience: A user-friendly interface, easy navigation, and responsive design
contribute to a positive user experience, enhancing customer satisfaction and retention.
SYSTEM SPECIFICATION
• Processor: i5, 10th Gen Intel Core, the speed of 2.50 GHz.
• RAM: 8 GB.
• ROM: 512 GB HDD.
• Monitor: Standard Colour Monitor, 16.1 inch.
• Key Board: Standard Keyboard.
• Mouse: Standard Mouse.
• Database : SQL
E-Commerce Website 7
SEA College Of Science, Commerce and Art’s
DETAILS OF SOFTWARES
OVERVIEW OF TECHNOLOGIES USED
Python is a high-level programming language known for its simplicity, readability, and versatility. Created
by Guido van Rossum and first released in 1991, Python has gained immense popularity due to its user-
friendly syntax and extensive standard library. It is widely used in various fields such as web development,
data analysis, scientific computing, artificial intelligence, and more.
• Readable and Elegant Syntax: Python's syntax is designed to be easy to read and write. The use of
indentation (whitespace) for code blocks enhances code readability and enforces a consistent style across
projects.
• Interpreted and Interactive: Python is an interpreted language, which means that code is executed line by
line by an interpreter rather than being compiled beforehand. This allows for quick experimentation and
interactive development using tools like the Python interpreter or Jupyter notebooks.
• Extensive Standard Library: Python comes with a comprehensive standard library that provides modules
and functions for a wide range of tasks, from file I/O and networking to data manipulation and regular
expressions. This reduces the need to build everything from scratch.
• Large and Active Community: Python has a vast and active community of developers, which means
there's a wealth of documentation, tutorials, libraries, and frameworks available. This community support
can greatly aid in learning and problem-solving.
• Versatility: Python can be used for a wide array of applications. It's utilized in web development (using
frameworks like Django and Flask), data analysis (with libraries like pandas and NumPy), scientific
computing (using tools like SciPy), machine learning and artificial intelligence (with TensorFlow, PyTorch,
and scikit-learn), and more.
E-Commerce Website 8
SEA College Of Science, Commerce and Art’s
•Open Source: Python is open source, meaning its source code is freely available for anyone to view, use,
modify, and distribute. This fosters collaboration and innovation within the developer community.
• Dynamic Typing: Python is dynamically typed, meaning variable types are determined at runtime. This
allows for more flexible and expressive code but also requires careful consideration to prevent type-related
errors.
•Third-Party Libraries and Packages: The Python Package Index (PyPI) hosts an enormous collection of
third-party libraries and packages, which further extend Python's capabilities. Developers can easily install
and use these packages using package managers like pip
Introduction to HTML
The Hypertext Markup Language (HTML) is a simple markup language. Used to create a hypertext
document that are portable from one platform to another HTML documents are SGML (Standard generalized
markup language) documents with generic semantics that are appropriate for representing information from a
wide range of applications. This specification defines HTML version 3.2. HTML 3.2 aims to capture
recommended practice as of early '96 and as such a replacement for HTML2.0 (RFC 1866).
A set of instructions embedded in a document is called markup language. These instructions describe
what the document text means and how it should look like in a display. Hyper Text Mark Up language (HTML)
is the language used to encode World Wide Web documents.
HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like
<html>). HTML tags most commonly come in pairs like <h1> and </h1>, although some tags represent empty
elements and so are unpaired, for example <img>. The first tag in a pair is the start tag, and the second tag is
the end tag (they are also called opening tags and closing tags).
The purpose of a web browser is to read HTML documents and compose them into visible or audible
web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.
HTML describes the structure of a website semantically along with cues for presentation, making it a markup
language rather than a programming language.
HTML elements form the building blocks of all websites. HTML allows images and objects to be
embedded and can be used to create interactive forms. It provides a means to create structured documents by
denoting structural semantics for text such as headings, paragraphs, lists, links, quotes and other items. It can
embed scripts written in languages such as JavaScript which affect the behavior of HTML web pages.
HTML LAYOUT:
An HTML document consists of text, which comprises the content of the document and tags, which
defines the structure and appearance of the document. The structure of an HTML document is simple, consists
of outer.
E-Commerce Website 9
SEA College Of Science, Commerce and Art’s
This is where the actual HTML documents Text lies, which is displayed in the browser
</BODY>
</HTML>
Each document has a head and body delimited by the<HEAD> and<BODY> tag. The head is where
you give your HTML document a title and where you indicate other parameters the browser may use when
displayed the document. This includes the text for displaying the text. Tag also references special and indicates
the hot spots that link your document to another document.
Introduction of JavaScript:
JavaScript is a new scripting language for Webpages. Scripts written with JavaScript can be embedded
into your HTML pages. With java script you have many possibilities for enhancing your HTML page with
interesting elements. For example, you are able to respond to user-initiated events quite easily. Some effects
that are now possible with java script were sometimes ago only possible with CGI. So, you can create really
sophisticated pages with the help of java script on the Internet.
The first browser to support java script was the Netscape Navigator 2.0 of course the higher versions
do have java script as well You might know that java does not run on all Netscape Navigators 2.0 (or higher
versions) versions. But this is not true for java script although there are some problems with the different
versions.
The mac version for example seems to have many bugs. In the near future there are going to be some
other browsers, which support java script. The Microsoft internet explorer 3.0 is going to support java script.
Java script enabled browsers are going to spread soon- it is worth learning this new technique now. You might
realize that is really easy to write Java Script scripts. We have to know some basic techniques and some work-
around for problems you might encounter an HTML document.
<html>
<head>
My first JavaScript
</head>
<body><br>
This is a normal HTML document <br>
<script language="JavaScript> Document. Write (“this is a java script”)
</script><br> Backing HTML again
</body>
</html>
Introduction to CSS
CSS, or Cascading Style Sheets, is a stylesheet language used to describe the presentation and visual design
of web pages written in HTML (Hypertext Markup Language). In web development, HTML defines the
structure and content of a webpage, while CSS determines how that content should be styled, positioned, and
visually presented to users.
E-Commerce Website 10
SEA College Of Science, Commerce and Art’s
• Styling Elements: CSS is primarily responsible for styling various elements on a webpage, such as
fonts, colors, backgrounds, margins, padding, borders, and more. It allows web developers to control
the visual appearance of these elements to create a cohesive and visually appealing design.
• Layout Control: CSS provides layout control by positioning elements on a webpage, specifying their
dimensions, and arranging them in columns, grids, or other layout structures. This ensures a consistent
and organized design across different devices and screen sizes.
• Responsive Design: With CSS, web developers can create responsive designs that adapt to different
screen sizes, from desktop monitors to mobile devices. This is achieved through techniques like media
queries, which adjust the styling based on the user's device characteristics.
• Typography: CSS enables precise control over text formatting, such as font type, size, line height,
letter spacing, and text alignment. This ensures a visually appealing and readable presentation of
textual content.
• Animations and Transitions: CSS allows the creation of animations and transitions to add dynamic
and interactive elements to web pages. This includes effects like fades, slides, rotations, and more,
enhancing the user experience.
• Flexibility: By using classes and IDs, CSS offers flexibility in applying styles selectively to specific
elements, ensuring consistent design patterns across a website.
• Separation of Concerns: One of the fundamental principles of web development is the separation of
concerns. CSS facilitates this by separating the content (HTML) from the presentation (CSS), making
code maintenance and updates more efficient.
CSS operates on the concept of cascading, where multiple styles can be applied to the same HTML element.
Styles are applied based on specificity and order of appearance, allowing for a hierarchical approach to styling.
To implement CSS in a webpage, developers use various selectors to target HTML elements, and then apply
property-value pairs to define the desired styles. For example:
```css
/* Selects all <h1> elements and sets their color to blue */
h1 {
color: blue;
}
E-Commerce Website 11
SEA College Of Science, Commerce and Art’s
In summary, CSS is a fundamental technology in web development that enables designers and developers to
control the visual appearance of web pages, create appealing layouts, and enhance the user experience through
styling and presentation.
SQL Introduction
MySQL is an open-source relational database management system that works on many platforms. It
provides multi-user access to support many storage engines and is backed by Oracle. So, you can buy a
commercial license version from Oracle to get premium support services.
A Database Management System (DBMS) is a software application that interacts with the user,
applications and the database itself to capture and analyze data. The data stored in the database can be
modified, retrieved and deleted, and can be of any type like strings, numbers, images etc.
Types of DBMS
There are mainly 4 types of DBMS, which are Hierarchical, Relational, Network, and Object-Oriented
DBMS.
• Hierarchical DBMS: As the name suggests, this type of DBMS has a style of predecessorsuccessor type
of relationship. So, it has a structure similar to that of a tree, wherein the nodes represent records and the
branches of the tree represent fields.
• Relational DBMS (RDBMS): This type of DBMS, uses a structure that allows the users to identify and
access data in relation to another piece of data in the database.
• Network DBMS: This type of DBMS supports many to many relations wherein multiple member records
can be linked.
• Object-oriented DBMS: This type of DBMS uses small individual software called objects. Each object
contains a piece of data, and the instructions for the actions to be done with the data.
E-Commerce Website 12
SEA College Of Science, Commerce and Art’s
• DDL (Data Definition Language) – It allows you to perform various operations on the database such as
CREATE, ALTER and DELETE objects.
• DML (Data Manipulation Language) – It allows you to access and manipulate data. It helps you to insert,
update, delete and retrieve data from the database.
• DCL (Data Control Language) – It allows you to control access to the database. Example – Grant or
Revoke access permissions.
• TCL (Transaction Control Language) – It allows you to deal with the transaction of the database. Example
– Commit, Rollback, save point, Set Transaction.
• Numeric – This data type includes integers of various sizes, floating- point(real) of various precisions and
formatted numbers.
• Character-string – These data types either have a fixed, or a varying number of characters. This data
type also has a variable-length string called CHARACTER LARGE OBJECT (CLOB) which is
used to specify columns that have large text values.
E-Commerce Website 13
SEA College Of Science, Commerce and Art’s
• Bit-string – These data types are either of a fixed length or varying length of bits. There is also a variable-
length bit string data type called BINARY LARGE OBJECT(BLOB), which is available to specify
columns that have large binary values, such as images.
• Boolean – This data type has TRUE or FALSE values. Since SQL, has NULL values, a three-valued logic
is used, which is UNKNOWN.
• Date & Time – The DATE data type has: YEAR, MONTH, and DAY in the form YYYYMM-DD.
Similarly, the TIME data type has the components HOUR, MINUTE, and SECOND in the form HH:MM:
SS. These formats can change based on the requirement.
• Timestamp & Interval – The TIMESTAMP data type includes a minimum of six positions, for decimal
fractions of seconds and an optional WITH TIME ZONE qualifier in addition to the DATE and TIME
fields. The INTERVAL data type mentions a relative value that can be used to increment or decrement an
absolute value of a date, time, or timestamp.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
System analysis is a process of gathering and interpreting facts, diagnosing problems and the
information to recommend improvements on the system. It is a problem-solving activity that requires intensive
communication between the system users and system developers. System analysis or study is an important
phase of any system development process. The system is studied to the minutest detail and analyzed. The
system analyst plays the role of the interrogator and dwells deep into the working of the present system. The
system is viewed as a whole and the input to the systems are identified.
The data collected by these sources must be scrutinized to arrive to a conclusion. The conclusion is an
understanding of how the system functions. This system is called the existing system. Now the existing system
is subjected to close study and problems areas are identified. The designer now functions as a problem solver
and tries to sort out the difficulties that the enterprise faces. The solutionsare given as proposals. The proposal
is then weighed with the existing system analytically and the best one is selected. The proposal is reviewed on
user request and suitable changes are made. This is loop that ends as soon as the user is satisfiedwith proposal.
It does various feasibility studies.
E-Commerce Website 14
SEA College Of Science, Commerce and Art’s
In these studies, a rough figure of the system activities can be obtained, from which the decision about
the strategies to be followed for effective system study and analysis can be taken.
There are some important modules in the purpose system, which are:
Login for admin: This module will allow the administrator to enter their respective forms.
Login for user: This module will allow the user to view their profile and check for the updation.
EXISTING SYSTEM
In E-commerce website if we take the current system and compare with the proposed it is far behind.
Every work in the existing is manual and done on the paper. There might be a computer used somewhere
for the work but it’s is not doing exactly it’s is supposed which is reducing the manual work. Entering
everything manually to the computer by creating a file is not exactly we are talking in computerization.
The existing system requires a lot of manual work which results in taking more time than it should.
The operations like updating and synchronizing data are also done manually in the existing system that is
not automated and again time-consuming process. These practices are not at all reliable as the one wrong
entry can take a lot of time in detection and then there is a correction. Humans are prone to errors and can
mistakes often unless it has
some inbuilt programs which can take check the input and save from error Some major drawbacks of the
existing system:
1. Required a lot of paperwork and the process takes time.
2. Everything is done on the paper and these are highly prone to damages and requires a good amount of
security and space to store.
3. Required Buying of goods more frequent as compared to online system e.g.: paper, pen.
4. Likely to have an error.
PROPOSED SYSTEM
In E-commerce website after the planning and analysis phase of the system gets completed. Then the
next phase required to transform the collected required system information into structural blueprint which
will serve as a reference while constructing the working system.
It is a phase when most of the risks and errors unveiled so it’s is good practice to take care of this thing
from the start.
This will be a completely fledged system which can be the backbone of the whereas management of
the gymnasium therefore ignoring the chance or error isn't associated possibility as later it can create a
larger style of itself. So, it is better to minimize the problems faced by both staff and the manager in the
Organization.
E-Commerce Website 15
SEA College Of Science, Commerce and Art’s
1. The projected system is very secured, as a result of for login the system it needs the username and
watchword that is completely different for every department thus providing each department a special read
of the member data.
2. It provides a wide selection of sure criteria in every window the shopper is functioning for higher and
faster answer.
3. Manages member data individually for all exercise and worker data individually for considering the wants
of gymnasium.
4. Stores data regarding regular machines.
5. This technique will run on any windows software package.
FEASIBILITY STUDY
After responsibility the plan E-commerce website, study and investigating all the current or
compulsory functionalities of the organization, the next job is to do the viability study for the project. All
plans feasible – given limitless resources and immeasurable time.
All the conceivable ways to deliver a solution to the given problem are find by feasibility study. This
planned answer would please all the workers need and must be flexible plenty so that future vicissitudes
can be simply done founded on the future imminent supplies.
A feasibility study of a system proposal is according to its workability, which is the impact on the
organization’s ability to meet their user needs and effective use of resources, thus when a new application
is proposed it normally goes through a feasibility study before it is approved for development. Different
tests of feasibility are studied during the investigation.
• Technical feasibility
• Economic feasibility
• Operational feasibility
• Physical feasibility
TECHNICAL FEASIBILITY
This is considered with specifying equipment and software that will successfully satisfy the user
requirement. It involves determining whether or not a system can actually be constructed or upgraded to solve
the problem at hand. The technical needs of a system may vary considerably, but might include and following:
1. The necessary technology of both hardware and software existed and also could be acquired for the
new system.
2. As the improvement in storage technology has developed over the recent years, data storage is
becoming easier and safer.
3. The new system with powerful database technology has the capability to hold the proposed data.
4. Technically, the system is designed in such a way that is provides accuracy, reliability, easy access, data
security and integrity.
ECONOMIC FEASIBILITY
Economic feasibility involves estimating benefits and costs. These benefits and costs may be tangible
or intangible. It is seen whether the expenditure incurred for developing the new system will be cost effective
or not. Because of the confusion between the types of costs, it is sometimes very difficult to decide if the
E-Commerce Website 16
SEA College Of Science, Commerce and Art’s
benefits outweigh the costs. The basically involves top-level management of the company who are the decision
makers. Some key fin dings from the study are listed below.
OPERATIONAL FEASIBILITY
Operational feasibility deals with the human aspects of the organization, proposed projects are
beneficial only if they can be turned into information systems that will meet the organization’s operating
requirements. This feasibility test asks whether the system will work when developed and installed, the users
need to be convinced about the advantages of the new system.
PHYSICAL FEASIBILITY
It involves study to establish the time responses of the new system being created. For
e.g., if the new system takes more than one day to prepare crucial finance statement for the management,
wherever it was required in an hour, the system fails to provide the same.
It should be clearly established that the new system requirements in the form of time responses would be
completely met with. It may call for increase in cost. If the required cost is sacrificed then the purpose of the
new system may not be achieved even if it was found to be technically feasible.
MODULES
MODULES: This project contains 2 modules, those are
• Admin
• User
MODULES DESCRIPTION:
Admin: -
• Home: In this section, Admin can see total orders, pending orders, total products, total users,
and messages.
• Products: In this section, admin can manage the products like add the products and remove
or delete the products.
• Order: In this section, admin can manage the orders where users placed orders.
• Users: In this section admin can manage the all accounts.
• Message: In this section, admin can see the all message which users send the feedback.
Admin can also update his profile, change the password and recover the password.
User: -
• Home: In this section, User can see the products.
E-Commerce Website 17
SEA College Of Science, Commerce and Art’s
• Shop: In this section, User can add the products into the Cart or Wishlist the user can order
the products.
• Order: In this section user can see the order details.
• About: In this section user can see about grocery store.
• Feedback: In this section User can give feedback to the admin.
User can also update his profile, change the password and recover the password.
SYSTEM DESIGN
Design is the first step in the development phase for any techniques and principles for
the purpose of defining a device, a process, or a system in sufficient detail to permit its physical
realization.
Once the software requirements have been analysed and specified the software design
involves three technical activities - design, coding, implementation, and testing that are
required to build and verify the software.
The design activities are of main importance in this phase because in this activity,
decisions ultimately affecting the success of the software implementation and its ease of
maintenance are made. These decisions have the final bearing upon the reliability and
maintainability of the system. Design is the only way to accurately translate the customer’s
requirements into finished software or a system.
Design is the place where quality is fostered in development. Software design is a
process through which requirements are translated into a representation of software. Software
design is conducted in two steps.
Preliminary design is concerned with the transformation of requirements into data
USECASE DIAGRAM:
The purpose it to show the interactions between the use case and actor.
E-Commerce Website 18
SEA College Of Science, Commerce and Art’s
E-Commerce Website 19
SEA College Of Science, Commerce and Art’s
A Data Flow Diagram (DFD) is a traditional visual representation of the information flows within a
system. A neat and clear DFD can depict the right amount of the system requirement graphically. It can be
manual, automated, or a combination of both.
It shows how data enters and leaves the system, what changes the information, and where data is stored.
The objective of a DFD is to show the scope and boundaries of a system as a whole. It may be used as
a communication tool between a system analyst and any person who plays a part in the order that acts as a
starting point for redesigning a system. The DFD is also called as a data flow graph or bubble chart.
1. All names should be unique. This makes it easier to refer to elements in the DFD.
2. Remember that DFD is not a flow chart. Arrows is a flow chart that represents the order of events;
arrows in DFD represent flowing data. A DFD does not involve any order of events.
3. Suppress logical decisions. If we ever have the urge to draw a diamond- shaped box in a DFD, suppress
that urge! A diamond-shaped box is used in flow charts to represents decision points with multiple exists
paths of which the only one is taken. This implies an ordering of events, which makes no sense in a
DFD.
4. Do not become bogged down with details. Defer error conditions and error handling until the end of
the analysis.
Standard symbols for DFDs are derived from the electric circuit diagram analysis and are shown in fig:
E-Commerce Website 20
SEA College Of Science, Commerce and Art’s
Circle: A circle (bubble) shows a process that transforms data inputs into data outputs.
Data Flow: A curved line shows the flow of data into or out of a process or data store.
Data Store: A set of parallel lines shows a place for the collection of data items. A data store indicates that the
data is stored which can be used at a later stage or by the other processes in a different order. The data store
can have an element or group of elements.
Source or Sink: Source or Sink is an external entity and acts as a source of system inputs or sink of system
outputs.
Zero Level DFD:
E-commerce
website
E-Commerce Website 21
SEA College Of Science, Commerce and Art’s
User:
ENTITY-RELATIONSHIP Diagrams
E-R (Entity-Relationship) Diagram is used to represents the relationship between entities in the table.
The Entity-Relationship model was originally proposed by Peter In 1976 (Chen76) as a way to unify
the network and relational database views. Simply, stated the ER model is a conceptual data model that mews
the real world as and relationship. A basic component of the model is the Entity-Relationship diagram which
is used
E-Commerce Website 22
SEA College Of Science, Commerce and Art’s
to visually represents data objects. Since Chen wrote his paper the model has been extended and today it is
commonly used for database design for the database designer, the utility of the ER model is:
• It maps well to the relational model. The constructs used in the ER model can easily be transformed into
relational tables.
• It is simple and easy to understand with a minimum of training. Therefore, the model can be used by the
database designer to communicate the design to the end user
• In addition, the model can be used as a design plan by the database developer to implement a data model
in a specific database management software.
ER Notation
There is no standard for representing data objects in ER diagrams. Each modeling methodology uses
its own notation. The original notation used by Chen is widely used in academic texts and journals but rarely
seen in either CASE tools or publications by nonacademics. Today, there are a number of notations used,
among the more common are Bachman, crow’s foot, and IDEFIX.
All notational styles represent entities as rectangular boxes and relationships as lines connecting boxes.
Each style uses a special set of symbols to represent the cardinality of a connection. The notation used in this
document is from Martin e symbols used for the basic ER constructs are:
• entities are represented by labelled rectangles. The label is the name of the entity. Entity names should be
singular nouns.
• relationships are represented by a solid line connecting two entities. The name of the relationship is written
above the line. Relationship names, should be verbs.
• Entity- this represents the name of an object, person, thing, event, or place where data is stored. This is
usually represented by rectangles.
• Weak Entity- unlike a strong entity that is defined by its attributes, a weak entity solely depends on the
existence of another entity.
E-Commerce Website 23
SEA College Of Science, Commerce and Art’s
• Cardinality- this refers to the occurrences of a relationship. In particular, it specifies the maximum
number of relationships between two entities.
• Ordinality- describes whether a relationship is mandatory or optional. It is also used to determine the
absolute minimum number of relationships.
E-Commerce Website 24
SEA College Of Science, Commerce and Art’s
ER DIAGRAM:
Database Design
The data in the system has to be stored and retrieved from the database. Designing the database is part
of system design. Data elements and data structures to be stored have been identified at the analysis stage.
They are structured and put together to design the data storage and retrieval system.
A database is a collection of interrelated data stored with minimum redundancy to serve many users
quickly and efficiently. The general objective is to make database access easy, quick, inexpensive and flexible
for the user. Relationships are established between the data items and unnecessary data items are removed.
Normalization is done to get an internal consistency of data and to have minimum redundancy and maximum
stability. This ensures minimizing data storage required, minimizing chances of data inconsistencies and
optimizing for updates. The MySQL database has been chosen for developing the relevant databases.
E-Commerce Website 25
SEA College Of Science, Commerce and Art’s
E-Commerce Website 26
SEA College Of Science, Commerce and Art’s
E-Commerce Website 27
SEA College Of Science, Commerce and Art’s
Class Diagram:
The class diagram shows a set of classes, interfaces, collaborations and their relationships.
TESTING
Introduction to Testing:
Software testing is an investigation conducted to provide stakeholders with information about the
quality of the software product or service under test. Software testing can also provide an objective,
independent view of the software to allow the business to appreciate and understand the risks of software
implementation. Test techniques include the process of executing a program or application with the intent of
finding software bugs (errors or other defects), and verifying that the software product is fit for use. Software
testing involves the execution of a software component or system component to evaluate one or more
properties of interest.
Test Plan
A test plan implies a series of desired course of action to be followed in accomplishing various testing
methods. The test plan acts as a blue print for the action that is to followed. The software engineers create a
computer program, its documentation and related data structures. The software developers is always
responsible for testing the individual units of the programs, ensuring that each platforms the function for which
it was designed. There is an independent test group (ITG) which is to remove the inherent problems associated
with letting the builder to test the thing that has been built.
E-Commerce Website 28
SEA College Of Science, Commerce and Art’s
2. Integration testing
3. Acceptance testing
Unit Testing:
The first level of testing is called unit testing. Here different modules are tested against the
specifications produced during the design of the modules. Unit testing is done to test the working of individual
modules with test oracles.
Unit testing comprises a set of tests performed by an individual programmer prior to the integration of the
units into a large system. A system unit is usually small enough that the programmer who developed it can test
it in a great detail. Unit testing focuses first the modules to locate errors. These errors are verified and corrected
so that the unit perfectly fits to the project.
In our project E-commerce website, the code is divided into many units. We have used divide and conquer
technique. Each unit is separated and tested according to the user comfort. There is a line separating after each
part of the coding. It is easier to correct the errors.
Integration Testing:
The next level of testing is called the Integration Testing. In this many tested modules are combined
into subsystems, which were then tested.
Test case data is prepared to check the control flow of all the modules and to exhaust all possible inputs
to the program. Situations like treating the modules where there is no data entered in the next box are also
tested.
This testing strategy dictates the order in which modules must be available,and exerts strong influence
on the order in which the modules must be written. Debugged and unit tested. In Integration testing, all the
modules/units on which unit testing is performed are integrated together and tested.
In any project, there are different modules or subsystems. These subsystems are tested and combined
together or integrated together to form a bigger module or sometimes a whole system. This is done by
integration testing.
Acceptance Testing:
This testing is performed finally by user to demonstrate that the implemented system satisfies its
requirements. The user gives various inputs to get required outputs.
In our project, we have designed it in a way where any form of people can understand and use it.
Types of Testing
The general testing process is the creation of a testing strategy (which sometimes includes the
execution of the testing case), creation of a test plan/design (which usually includes test case and test
procedure) and the execution of tests. Test are inputs that have been devised to test the system.
1. Black-Box Testing
2. White Box Testing
3. Alpha Testing
4. Beta Testing
E-Commerce Website 29
SEA College Of Science, Commerce and Art’s
1) Black-Box Testing: -
Black box Testing is a software testing method in which the internal structure/design/implementation
of the item being tested is not known to the tester. These tests can be functional or non-functional. It focuses
on the functional requirements of the software. In black-box testing, the cases are derived from the
specification of the system, the implementation details of the system are not taken into considerations.
3) Alpha Testing: -
Alpha testing is simulated for actual operational testing by potential users/customers or an independent
test team at the developer’s site. Alpha testing is often employed for off-theself software as a form of internal
acceptance testing before the software goes to beta testing.
4) Beta Testing: -
Beta testing comes after alpha testing. Version of the software, known as beta versions, is related to a
limited audience outside of the programming team. The software is released to groups of people so that further
testing can ensure the product has few faults or bugs.
CODING
Settings.json
{
"cSpell.words": [
"Arti",
"ASGI",
"njvmt",
"uidb"
]
}
Accounts
"""
ASGI config for ArtiZan project.
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ArtiZan.settings')
application = get_asgi_application()
class AccountsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'accounts'
from django import forms
from .models import Account, UserProfile
class RegistrationForm(forms.ModelForm):
E-Commerce Website 30
SEA College Of Science, Commerce and Art’s
password = forms.CharField(widget=forms.PasswordInput(attrs={
'placeholder': 'Enter Password',
'class': 'form-control',
}))
confirm_password = forms.CharField(widget=forms.PasswordInput(attrs={
'placeholder': 'Confirm Password'
}))
class Meta:
model = Account
fields = ['first_name', 'last_name', 'phone_number', 'email', 'password']
def clean(self):
cleaned_data = super(RegistrationForm, self).clean()
password = cleaned_data.get('password')
confirm_password = cleaned_data.get('confirm_password')
if password != confirm_password:
raise forms.ValidationError(
"Password does not match!
)
class UserForm(forms.ModelForm):
class Meta:
model = Account
fields = ('first_name', 'last_name', 'phone_number')
class UserProfileForm(forms.ModelForm):
# image link path hiding
profile_picture = forms.ImageField(required=False, error_messages = {'invalid':("Image files
only")}, widget=forms.FileInput)
class Meta:
model = UserProfile
fields = ('address_line_1', 'address_line_2', 'city', 'state', 'country',
'profile_picture')
class MyAccountManager(BaseUserManager):
def create_user(self, first_name, last_name, username, email, password=None):
if not email:
raise ValueError('User must have an email address')
if not username:
raise ValueError('User must have an username')
user = self.model(
email = self.normalize_email(email),
username = username,
first_name = first_name,
last_name = last_name,
)
E-Commerce Website 31
SEA College Of Science, Commerce and Art’s
user.set_password(password)
user.save(using=self._db)
return user
class Account(AbstractBaseUser):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50)
username = models.CharField(max_length=50, unique=True)
email = models.EmailField(max_length=100, unique=True)
phone_number = models.CharField(max_length=50)
# required
date_joined = models.DateTimeField(auto_now_add=True)
last_login = models.DateTimeField(auto_now_add=True)
is_admin = models.BooleanField(default=False)
is_staff = models.BooleanField(default=False)
is_active = models.BooleanField(default=False)
is_superadmin = models.BooleanField(default=False)
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['username', 'first_name', 'last_name']
objects = MyAccountManager()
def full_name(self):
return f'{self.first_name} {self.last_name}'
def __str__(self):
return self.email
class UserProfile(models.Model):
user = models.OneToOneField(Account, on_delete=models.CASCADE)
address_line_1 = models.CharField(blank=True, max_length=100)
address_line_2 = models.CharField(blank=True, max_length=100)
profile_picture = models.ImageField(blank=True, upload_to='userprofile')
city = models.CharField(blank=True, max_length=20)
state = models.CharField(blank=True, max_length=20)
country = models.CharField(blank=True, max_length=20)
def __str__(self):
return self.user.first_name
def full_address(self):
return f'{self.address_line_1} {self.address_line_2}'
from django.test import TestCase
urlpatterns = [
E-Commerce Website 32
SEA College Of Science, Commerce and Art’s
# Verification email
from django.contrib.sites.shortcuts import get_current_site
from django.template.loader import render_to_string
from django.utils.http import urlsafe_base64_encode, urlsafe_base64_decode
from django.utils.encoding import force_bytes
from django.contrib.auth.tokens import default_token_generator
from django.core.mail import EmailMessage
def register(request):
if request.method == 'POST':
form = RegistrationForm(request.POST)
if form.is_valid():
first_name = form.cleaned_data['first_name']
last_name = form.cleaned_data['last_name']
phone_number = form.cleaned_data['phone_number']
email = form.cleaned_data['email']
password = form.cleaned_data['password']
username = email.split("@")[0]
user = Account.objects.create_user(first_name=first_name, last_name=last_name,
email=email, username=username, password=password)
user.phone_number = phone_number
user.save()
# USER ACTIVATION
current_site = get_current_site(request)
mail_subject = 'Please activate your account'
message = render_to_string('accounts/account_verification_email.html', {
'user': user,
'domain': current_site,
'uid': urlsafe_base64_encode(force_bytes(user.pk)),
'token': default_token_generator.make_token(user),
})
to_email = email
send_email = EmailMessage(mail_subject, message, to=[to_email])
send_email.send()
# messages.success(request, 'Thank you for registering with us. We have sent you a
verification email to your email address [[email protected]]. Please verify it.')
E-Commerce Website 33
SEA College Of Science, Commerce and Art’s
return redirect('/accounts/login/?command=verification&email='+email)
else:
form = RegistrationForm()
context = {
'form': form,
}
return render(request, 'accounts/register.html', context)
def login(request):
if request.method == 'POST':
email = request.POST['email']
password = request.POST['password']
# Get the cart items from the user to access his product variations
cart_item = CartItem.objects.filter(user=user)
ex_var_list = []
id = []
for item in cart_item:
existing_variation = item.variations.all()
ex_var_list.append(list(existing_variation))
id.append(item.id)
# product_variation = [1, 2, 3, 4, 6]
# ex_var_list = [4, 6, 3, 5]
for pr in product_variation:
if pr in ex_var_list:
index = ex_var_list.index(pr)
item_id = id[index]
item = CartItem.objects.get(id=item_id)
item.quantity += 1
item.user = user
item.save()
else:
cart_item = CartItem.objects.filter(cart=cart)
for item in cart_item:
item.user = user
item.save()
except:
pass
auth.login(request, user)
messages.success(request, 'You are now logged in.')
url = request.META.get('HTTP_REFERER')
try:
query = requests.utils.urlparse(url).query
# next=/cart/checkout/
params = dict(x.split('=') for x in query.split('&'))
if 'next' in params:
nextPage = params['next']
return redirect(nextPage)
except:
return redirect('dashboard')
else:
messages.error(request, 'Invalid login credentials')
return redirect('login')
return render(request, 'accounts/login.html')
@login_required(login_url = 'login')
def logout(request):
E-Commerce Website 34
SEA College Of Science, Commerce and Art’s
auth.logout(request)
messages.success(request, 'You are logged out.')
return redirect('login')
@login_required(login_url = 'login')
def dashboard(request):
orders = Order.objects.order_by('-created_at').filter(user_id=request.user.id,
is_ordered=True)
orders_count = orders.count()
userprofile = UserProfile.objects.get(user_id=request.user.id)
context = {
'orders_count': orders_count,
'userprofile': userprofile,
}
return render(request, 'accounts/dashboard.html', context)
def forgotPassword(request):
if request.method == 'POST':
email = request.POST['email']
if Account.objects.filter(email=email).exists():
user = Account.objects.get(email__exact=email)
E-Commerce Website 35
SEA College Of Science, Commerce and Art’s
def resetPassword(request):
if request.method == 'POST':
password = request.POST['password']
confirm_password = request.POST['confirm_password']
if password == confirm_password:
uid = request.session.get('uid')
user = Account.objects.get(pk=uid)
user.set_password(password)
user.save()
messages.success(request, 'Password reset successful')
return redirect('login')
else:
messages.error(request, 'Password do not match!')
return redirect('resetPassword')
else:
return render(request, 'accounts/resetPassword.html')
@login_required(login_url='login')
def my_orders(request):
orders = Order.objects.filter(user=request.user, is_ordered=True).order_by('-created_at')
context = {
'orders': orders,
}
return render(request, 'accounts/my_orders.html', context)
@login_required(login_url='login')
def edit_profile(request):
userprofile = get_object_or_404(UserProfile, user=request.user)
if request.method == 'POST':
user_form = UserForm(request.POST, instance=request.user)
profile_form = UserProfileForm(request.POST, request.FILES, instance=userprofile)
if user_form.is_valid() and profile_form.is_valid():
user_form.save()
profile_form.save()
messages.success(request, 'Your profile has been updated.')
return redirect('edit_profile')
else:
user_form = UserForm(instance=request.user)
profile_form = UserProfileForm(instance=userprofile)
context = {
'user_form': user_form,
'profile_form': profile_form,
'userprofile': userprofile,
}
return render(request, 'accounts/edit_profile.html', context)
@login_required(login_url='login')
def change_password(request):
if request.method == 'POST':
current_password = request.POST['current_password']
new_password = request.POST['new_password']
confirm_password = request.POST['confirm_password']
user = Account.objects.get(username__exact=request.user.username)
if new_password == confirm_password:
success = user.check_password(current_password)
if success:
user.set_password(new_password)
user.save()
# auth.logout(request)
messages.success(request, 'Password updated successfully.')
return redirect('change_password')
else:
messages.error(request, 'Please enter valid current password')
return redirect('change_password')
else:
messages.error(request, 'Password does not match!')
return redirect('change_password')
return render(request, 'accounts/change_password.html')
@login_required(login_url='login')
def order_detail(request, order_id):
E-Commerce Website 36
SEA College Of Science, Commerce and Art’s
order_detail = OrderProduct.objects.filter(order__order_number=order_id)
order = Order.objects.get(order_number=order_id)
subtotal = 0
for i in order_detail:
subtotal += i.product_price * i.quantity
context = {
'order_detail': order_detail,
'order': order,
'subtotal': subtotal,
}
return render(request, 'accounts/order_detail.html', context)
ArtiZan
"""
ASGI config for ArtiZan project.
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ArtiZan.settings')
application = get_asgi_application()
"""
Django settings for ArtiZan project.
import os
from pathlib import Path
from decouple import config
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'shop',
'category',
'accounts',
'cart',
E-Commerce Website 37
SEA College Of Science, Commerce and Art’s
'orders',
'admin_honeypot',
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django_session_timeout.middleware.SessionTimeoutMiddleware',
]
ROOT_URLCONF = 'ArtiZan.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'category.context_processors.menu_links',
'cart.context_processors.counter',
],
},
},
]
WSGI_APPLICATION = 'ArtiZan.wsgi.application'
AUTH_USER_MODEL = 'accounts.Account' # admin path set up
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/
E-Commerce Website 38
SEA College Of Science, Commerce and Art’s
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_TZ = True
# STATIC_URL = '/static/'
# STATIC_ROOT = BASE_DIR /'static'
# STATICFILES_DIRS = [
# '/static',
# ]
STATIC_URL = '/static/'
STATICFILES_DIRS=[os.path.join(BASE_DIR,'static')]
STATIC_ROOT=os.path.join(BASE_DIR,'assets')
MEDIA_URL='/media/'
MEDIA_ROOT=os.path.join(BASE_DIR,'media')
# alert messages
from django.contrib.messages import constants as messages
MESSAGE_TAGS = {
messages.ERROR: 'danger',
}
# SMTP CONFIGURATION
EMAIL_BACKEND = config('EMAIL_BACKEND')
EMAIL_HOST = config('EMAIL_HOST',default='localhost')
EMAIL_PORT = config('EMAIL_PORT',cast=int)
EMAIL_USE_TLS = config('EMAIL_USE_TLS', cast=bool)
EMAIL_HOST_USER = config('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = config('EMAIL_HOST_PASSWORD')
# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include
from . import views
from django.conf.urls.static import static
from django.conf import settings
urlpatterns = [
path('admin/', include('admin_honeypot.urls', namespace='admin_honeypot')),# fake admin
path('zan123/', admin.site.urls),#admin urls you can change anytime
path('', views.home, name='home'),
path('shop/', include('shop.urls')),
path('cart/', include('cart.urls')),
path('accounts/', include('accounts.urls')),
E-Commerce Website 39
SEA College Of Science, Commerce and Art’s
# ORDERS
path('orders/', include('orders.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if settings.DEBUG:
urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
def home(request):
products = Product.objects.all().filter(is_available=True).order_by('created_date')
context = {
'products': products,
'reviews': reviews,
}
return render(request, 'home.html', context)
"""
WSGI config for ArtiZan project.
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ArtiZan.settings')
application = get_wsgi_application()
Cart
class Migration(migrations.Migration):
initial = True
dependencies = [
('shop', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Cart',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('cart_id', models.CharField(blank=True, max_length=250)),
('date_added', models.DateField(auto_now_add=True)),
],
),
migrations.CreateModel(
name='CartItem',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('quantity', models.IntegerField()),
E-Commerce Website 40
SEA College Of Science, Commerce and Art’s
('is_active', models.BooleanField(default=True)),
('cart', models.ForeignKey(null=True,
on_delete=django.db.models.deletion.CASCADE, to='cart.cart')),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='shop.product')),
('user', models.ForeignKey(null=True,
on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
('variations', models.ManyToManyField(blank=True, to='shop.Variation')),
],
),
]
class CartAdmin(admin.ModelAdmin):
list_display = ('cart_id', 'date_added')
class CartItemAdmin(admin.ModelAdmin):
list_display = ('product', 'cart', 'quantity', 'is_active')
admin.site.register(Cart, CartAdmin)
admin.site.register(CartItem, CartItemAdmin)
class CartConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'cart'
def counter(request):
cart_count = 0
if 'admin' in request.path:
return {}
else:
try:
cart = Cart.objects.filter(cart_id=_cart_id(request))
if request.user.is_authenticated:
cart_items = CartItem.objects.all().filter(user=request.user)
else:
cart_items = CartItem.objects.all().filter(cart=cart[:1])
for cart_item in cart_items:
cart_count += cart_item.quantity
except Cart.DoesNotExist:
cart_count = 0
return dict(cart_count=cart_count)
from django.db import models
from shop.models import Product, Variation
from accounts.models import Account
class Cart(models.Model):
cart_id = models.CharField(max_length=250, blank=True)
date_added = models.DateField(auto_now_add=True)
def __str__(self):
return self.cart_id
class CartItem(models.Model):
user = models.ForeignKey(Account, on_delete=models.CASCADE, null=True)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
variations = models.ManyToManyField(Variation, blank=True)
cart = models.ForeignKey(Cart, on_delete=models.CASCADE, null=True)
quantity = models.IntegerField()
is_active = models.BooleanField(default=True)
def sub_total(self):
return self.product.price * self.quantity
E-Commerce Website 41
SEA College Of Science, Commerce and Art’s
def __unicode__(self):
return self.product
from django.test import TestCase
urlpatterns = [
path('', views.cart, name='cart'),
path('add_cart/<int:product_id>/', views.add_cart, name='add_cart'),
path('remove_cart/<int:product_id>/<int:cart_item_id>/', views.remove_cart,
name='remove_cart'),
path('remove_cart_item/<int:product_id>/<int:cart_item_id>/', views.remove_cart_item,
name='remove_cart_item'),
def _cart_id(request):
cart = request.session.session_key
if not cart:
cart = request.session.create()
return cart
try:
variation = Variation.objects.get(product=product,
variation_category__iexact=key, variation_value__iexact=value)
product_variation.append(variation)
except:
pass
is_cart_item_exists = CartItem.objects.filter(product=product,
user=current_user).exists()
if is_cart_item_exists:
cart_item = CartItem.objects.filter(product=product, user=current_user)
ex_var_list = []
id = []
for item in cart_item:
existing_variation = item.variations.all()
ex_var_list.append(list(existing_variation))
id.append(item.id)
if product_variation in ex_var_list:
# increase the cart item quantity
index = ex_var_list.index(product_variation)
item_id = id[index]
item = CartItem.objects.get(product=product, id=item_id)
item.quantity += 1
item.save()
else:
item = CartItem.objects.create(product=product, quantity=1, user=current_user)
E-Commerce Website 42
SEA College Of Science, Commerce and Art’s
if len(product_variation) > 0:
item.variations.clear()
item.variations.add(*product_variation)
item.save()
else:
cart_item = CartItem.objects.create(
product = product,
quantity = 1,
user = current_user,
)
if len(product_variation) > 0:
cart_item.variations.clear()
cart_item.variations.add(*product_variation)
cart_item.save()
return redirect('cart')
# If the user is not authenticated
else:
product_variation = []
if request.method == 'POST':
for item in request.POST:
key = item
value = request.POST[key]
try:
variation = Variation.objects.get(product=product,
variation_category__iexact=key, variation_value__iexact=value)
product_variation.append(variation)
except:
pass
try:
cart = Cart.objects.get(cart_id=_cart_id(request)) # get the cart using the cart_id
present in the session
except Cart.DoesNotExist:
cart = Cart.objects.create(
cart_id = _cart_id(request)
)
cart.save()
print(ex_var_list)
if product_variation in ex_var_list:
# increase the cart item quantity
index = ex_var_list.index(product_variation)
item_id = id[index]
item = CartItem.objects.get(product=product, id=item_id)
item.quantity += 1
item.save()
else:
item = CartItem.objects.create(product=product, quantity=1, cart=cart)
if len(product_variation) > 0:
item.variations.clear()
item.variations.add(*product_variation)
item.save()
else:
cart_item = CartItem.objects.create(
product = product,
quantity = 1,
cart = cart,
)
E-Commerce Website 43
SEA College Of Science, Commerce and Art’s
if len(product_variation) > 0:
cart_item.variations.clear()
cart_item.variations.add(*product_variation)
cart_item.save()
return redirect('cart')
context = {
'total': total,
'quantity': quantity,
'cart_items': cart_items,
'tax' : tax,
'grand_total': grand_total,
}
return render(request, 'store/cart.html', context)
@login_required(login_url='login')
def checkout(request, total=0, quantity=0, cart_items=None):
try:
tax = 0
grand_total = 0
if request.user.is_authenticated:
cart_items = CartItem.objects.filter(user=request.user, is_active=True)
else:
cart = Cart.objects.get(cart_id=_cart_id(request))
cart_items = CartItem.objects.filter(cart=cart, is_active=True)
for cart_item in cart_items:
total += (cart_item.product.price * cart_item.quantity)
quantity += cart_item.quantity
E-Commerce Website 44
SEA College Of Science, Commerce and Art’s
tax = (2 * total)/100
grand_total = total + tax
except ObjectDoesNotExist:
pass #just ignore
context = {
'total': total,
'quantity': quantity,
'cart_items': cart_items,
'tax' : tax,
'grand_total': grand_total,
}
return render(request, 'store/checkout.html', context)
Category
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Category',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('category_name', models.CharField(max_length=50, unique=True)),
('slug', models.SlugField(max_length=100, unique=True)),
('description', models.TextField(blank=True, max_length=255)),
('cat_image', models.ImageField(blank=True, upload_to='photos/categories')),
],
options={
'verbose_name': 'category',
'verbose_name_plural': 'categories',
},
),
]
class CategoryAdmin(admin.ModelAdmin):
prepopulated_fields = {'slug': ('category_name',)}
list_display = ('category_name', 'slug')
admin.site.register(Category, CategoryAdmin)
class CategoryConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'category'
def menu_links(request):
links = Category.objects.all()
return dict(links=links)
from django.db import models
from django.urls import reverse
class Category(models.Model):
category_name = models.CharField(max_length=50, unique=True)
E-Commerce Website 45
SEA College Of Science, Commerce and Art’s
class Meta:
verbose_name = 'category'
verbose_name_plural = 'categories'
def get_url(self):
return reverse('products_by_category', args=[self.slug])
def __str__(self):
return self.category_name
from django.test import TestCase
Env
import os
import sys
from contextlib import suppress
VIRTUALENV_PATCH_FILE = os.path.join(__file__)
def patch_dist(dist):
"""
Distutils allows user to configure some arguments via a configuration file:
https://docs.python.org/3/install/index.html#distutils-configuration-files.
Some of this arguments though don't make sense in context of the virtual environment files,
let's fix them up.
""" # noqa: D205
# we cannot allow some install config as that would get packages installed outside of the
virtual environment
old_parse_config_files = dist.Distribution.parse_config_files
dist.Distribution.parse_config_files = parse_config_files
# Import hook that patches some modules to ignore configuration values that break package
installation in case
# of virtual environments.
_DISTUTILS_PATCH = "distutils.dist", "setuptools.dist"
# https://docs.python.org/3/library/importlib.html#setting-up-an-importer
class _Finder:
"""A meta path finder that allows patching the imported distutils modules."""
fullname = None
E-Commerce Website 46
SEA College Of Science, Commerce and Art’s
lock = threading.Lock()
# there is possibility that two threads T1 and T2 are simultaneously running
into find_spec,
# observing .lock as empty, and further going into hereby initialization.
However due to the GIL,
# list.append() operation is atomic and this way only one of the threads will
"win" to put the lock
# - that every thread will use - into .lock[0].
# https://docs.python.org/3/faq/library.html#what-kinds-of-global-value-
mutation-are-thread-safe
self.lock.append(lock)
with self.lock[0]:
self.fullname = fullname
try:
spec = find_spec(fullname, path)
if spec is not None:
# https://www.python.org/dev/peps/pep-0451/#how-loading-will-work
is_new_api = hasattr(spec.loader, "exec_module")
func_name = "exec_module" if is_new_api else "load_module"
old = getattr(spec.loader, func_name)
func = self.exec_module if is_new_api else self.load_module
if old is not func:
with suppress(AttributeError): # C-Extension loaders are r/o such
as zipimporter with <3.7
setattr(spec.loader, func_name, partial(func, old))
return spec
finally:
self.fullname = None
return None
@staticmethod
def exec_module(old, module):
old(module)
if module.__name__ in _DISTUTILS_PATCH:
patch_dist(module)
@staticmethod
def load_module(old, name):
module = old(name)
if module.__name__ in _DISTUTILS_PATCH:
patch_dist(module)
return module
sys.meta_path.insert(0, _Finder())
# coding: utf-8
import os
import sys
import string
from shlex import shlex
from io import open
from collections import OrderedDict
from distutils.util import strtobool
if PY3:
from configparser import ConfigParser
text_type = str
else:
E-Commerce Website 47
SEA College Of Science, Commerce and Art’s
DEFAULT_ENCODING = 'UTF-8'
class UndefinedValueError(Exception):
pass
class Undefined(object):
"""
Class to represent undefined type.
"""
pass
class Config(object):
"""
Handle .env file format used by Foreman.
"""
@staticmethod
def _cast_do_nothing(value):
return value
value = default
if isinstance(cast, Undefined):
cast = self._cast_do_nothing
elif cast is bool:
cast = self._cast_boolean
return cast(value)
class RepositoryEmpty(object):
def __init__(self, source='', encoding=DEFAULT_ENCODING):
pass
E-Commerce Website 48
SEA College Of Science, Commerce and Art’s
return None
class RepositoryIni(RepositoryEmpty):
"""
Retrieves option keys from .ini files.
"""
SECTION = 'settings'
class RepositoryEnv(RepositoryEmpty):
"""
Retrieves option keys from .env files with fall back to os.environ.
"""
def __init__(self, source, encoding=DEFAULT_ENCODING):
self.data = {}
class AutoConfig(object):
"""
Autodetects the config file and type.
Parameters
----------
search_path : str, optional
Initial search path. If empty, the default search path is the
caller's path.
"""
SUPPORTED = OrderedDict([
('settings.ini', RepositoryIni),
('.env', RepositoryEnv),
])
encoding = DEFAULT_ENCODING
E-Commerce Website 49
SEA College Of Science, Commerce and Art’s
def _caller_path(self):
# MAGIC! Get the caller's module path.
frame = sys._getframe()
path = os.path.dirname(frame.f_back.f_back.f_code.co_filename)
return path
# Helpers
class Csv(object):
"""
Produces a csv parser that return a list of transformed elements.
"""
class Choices(object):
"""
Allows for cast and validation based on a list of choices.
"""
E-Commerce Website 50
SEA College Of Science, Commerce and Art’s
self._valid_values = []
self._valid_values.extend(self.flat)
self._valid_values.extend([value for value, _ in self.choices])
import functools
import itertools
import operator
import sys
import types
if PY3:
string_types = str,
integer_types = int,
class_types = type,
text_type = str
binary_type = bytes
MAXSIZE = sys.maxsize
else:
string_types = basestring,
integer_types = (int, long)
class_types = (type, types.ClassType)
text_type = unicode
binary_type = str
if sys.platform.startswith("java"):
# Jython always uses 32 bits.
MAXSIZE = int((1 << 31) - 1)
else:
# It's possible to have sizeof(long) != sizeof(Py_ssize_t).
class X(object):
def __len__(self):
return 1 << 31
try:
len(X())
except OverflowError:
# 32-bit
MAXSIZE = int((1 << 31) - 1)
else:
# 64-bit
MAXSIZE = int((1 << 63) - 1)
E-Commerce Website 51
SEA College Of Science, Commerce and Art’s
del X
def _import_module(name):
"""Import module, returning the module after the last dot."""
__import__(name)
return sys.modules[name]
class _LazyDescr(object):
class MovedModule(_LazyDescr):
def _resolve(self):
return _import_module(self.mod)
class _LazyModule(types.ModuleType):
def __dir__(self):
attrs = ["__doc__", "__name__"]
attrs += [attr.name for attr in self._moved_attributes]
return attrs
class MovedAttribute(_LazyDescr):
E-Commerce Website 52
SEA College Of Science, Commerce and Art’s
self.attr = new_attr
else:
self.mod = old_mod
if old_attr is None:
old_attr = name
self.attr = old_attr
def _resolve(self):
module = _import_module(self.mod)
return getattr(module, self.attr)
class _SixMetaPathImporter(object):
"""
A meta path importer to import six.moves and its submodules.
_importer = _SixMetaPathImporter(__name__)
E-Commerce Website 53
SEA College Of Science, Commerce and Art’s
class _MovedItems(_LazyModule):
_moved_attributes = [
MovedAttribute("cStringIO", "cStringIO", "io", "StringIO"),
MovedAttribute("filter", "itertools", "builtins", "ifilter", "filter"),
MovedAttribute("filterfalse", "itertools", "itertools", "ifilterfalse", "filterfalse"),
MovedAttribute("input", "__builtin__", "builtins", "raw_input", "input"),
MovedAttribute("intern", "__builtin__", "sys"),
MovedAttribute("map", "itertools", "builtins", "imap", "map"),
MovedAttribute("getcwd", "os", "os", "getcwdu", "getcwd"),
MovedAttribute("getcwdb", "os", "os", "getcwd", "getcwdb"),
MovedAttribute("getoutput", "commands", "subprocess"),
MovedAttribute("range", "__builtin__", "builtins", "xrange", "range"),
MovedAttribute("reload_module", "__builtin__", "importlib" if PY34 else "imp", "reload"),
MovedAttribute("reduce", "__builtin__", "functools"),
MovedAttribute("shlex_quote", "pipes", "shlex", "quote"),
MovedAttribute("StringIO", "StringIO", "io"),
MovedAttribute("UserDict", "UserDict", "collections"),
MovedAttribute("UserList", "UserList", "collections"),
MovedAttribute("UserString", "UserString", "collections"),
MovedAttribute("xrange", "__builtin__", "builtins", "xrange", "range"),
MovedAttribute("zip", "itertools", "builtins", "izip", "zip"),
MovedAttribute("zip_longest", "itertools", "itertools", "izip_longest", "zip_longest"),
MovedModule("builtins", "__builtin__"),
MovedModule("configparser", "ConfigParser"),
MovedModule("collections_abc", "collections", "collections.abc" if sys.version_info >= (3,
3) else "collections"),
MovedModule("copyreg", "copy_reg"),
MovedModule("dbm_gnu", "gdbm", "dbm.gnu"),
MovedModule("dbm_ndbm", "dbm", "dbm.ndbm"),
MovedModule("_dummy_thread", "dummy_thread", "_dummy_thread" if sys.version_info < (3, 9)
else "_thread"),
MovedModule("http_cookiejar", "cookielib", "http.cookiejar"),
MovedModule("http_cookies", "Cookie", "http.cookies"),
MovedModule("html_entities", "htmlentitydefs", "html.entities"),
MovedModule("html_parser", "HTMLParser", "html.parser"),
MovedModule("http_client", "httplib", "http.client"),
MovedModule("email_mime_base", "email.MIMEBase", "email.mime.base"),
MovedModule("email_mime_image", "email.MIMEImage", "email.mime.image"),
MovedModule("email_mime_multipart", "email.MIMEMultipart", "email.mime.multipart"),
MovedModule("email_mime_nonmultipart", "email.MIMENonMultipart", "email.mime.nonmultipart"),
MovedModule("email_mime_text", "email.MIMEText", "email.mime.text"),
MovedModule("BaseHTTPServer", "BaseHTTPServer", "http.server"),
MovedModule("CGIHTTPServer", "CGIHTTPServer", "http.server"),
MovedModule("SimpleHTTPServer", "SimpleHTTPServer", "http.server"),
MovedModule("cPickle", "cPickle", "pickle"),
MovedModule("queue", "Queue"),
MovedModule("reprlib", "repr"),
MovedModule("socketserver", "SocketServer"),
MovedModule("_thread", "thread", "_thread"),
MovedModule("tkinter", "Tkinter"),
MovedModule("tkinter_dialog", "Dialog", "tkinter.dialog"),
MovedModule("tkinter_filedialog", "FileDialog", "tkinter.filedialog"),
MovedModule("tkinter_scrolledtext", "ScrolledText", "tkinter.scrolledtext"),
MovedModule("tkinter_simpledialog", "SimpleDialog", "tkinter.simpledialog"),
MovedModule("tkinter_tix", "Tix", "tkinter.tix"),
MovedModule("tkinter_ttk", "ttk", "tkinter.ttk"),
MovedModule("tkinter_constants", "Tkconstants", "tkinter.constants"),
MovedModule("tkinter_dnd", "Tkdnd", "tkinter.dnd"),
MovedModule("tkinter_colorchooser", "tkColorChooser",
"tkinter.colorchooser"),
MovedModule("tkinter_commondialog", "tkCommonDialog",
"tkinter.commondialog"),
MovedModule("tkinter_tkfiledialog", "tkFileDialog", "tkinter.filedialog"),
MovedModule("tkinter_font", "tkFont", "tkinter.font"),
MovedModule("tkinter_messagebox", "tkMessageBox", "tkinter.messagebox"),
MovedModule("tkinter_tksimpledialog", "tkSimpleDialog",
"tkinter.simpledialog"),
MovedModule("urllib_parse", __name__ + ".moves.urllib_parse", "urllib.parse"),
MovedModule("urllib_error", __name__ + ".moves.urllib_error", "urllib.error"),
MovedModule("urllib", __name__ + ".moves.urllib", __name__ + ".moves.urllib"),
E-Commerce Website 54
SEA College Of Science, Commerce and Art’s
_MovedItems._moved_attributes = _moved_attributes
class Module_six_moves_urllib_parse(_LazyModule):
_urllib_parse_moved_attributes = [
MovedAttribute("ParseResult", "urlparse", "urllib.parse"),
MovedAttribute("SplitResult", "urlparse", "urllib.parse"),
MovedAttribute("parse_qs", "urlparse", "urllib.parse"),
MovedAttribute("parse_qsl", "urlparse", "urllib.parse"),
MovedAttribute("urldefrag", "urlparse", "urllib.parse"),
MovedAttribute("urljoin", "urlparse", "urllib.parse"),
MovedAttribute("urlparse", "urlparse", "urllib.parse"),
MovedAttribute("urlsplit", "urlparse", "urllib.parse"),
MovedAttribute("urlunparse", "urlparse", "urllib.parse"),
MovedAttribute("urlunsplit", "urlparse", "urllib.parse"),
MovedAttribute("quote", "urllib", "urllib.parse"),
MovedAttribute("quote_plus", "urllib", "urllib.parse"),
MovedAttribute("unquote", "urllib", "urllib.parse"),
MovedAttribute("unquote_plus", "urllib", "urllib.parse"),
MovedAttribute("unquote_to_bytes", "urllib", "urllib.parse", "unquote", "unquote_to_bytes"),
MovedAttribute("urlencode", "urllib", "urllib.parse"),
MovedAttribute("splitquery", "urllib", "urllib.parse"),
MovedAttribute("splittag", "urllib", "urllib.parse"),
MovedAttribute("splituser", "urllib", "urllib.parse"),
MovedAttribute("splitvalue", "urllib", "urllib.parse"),
MovedAttribute("uses_fragment", "urlparse", "urllib.parse"),
MovedAttribute("uses_netloc", "urlparse", "urllib.parse"),
MovedAttribute("uses_params", "urlparse", "urllib.parse"),
MovedAttribute("uses_query", "urlparse", "urllib.parse"),
MovedAttribute("uses_relative", "urlparse", "urllib.parse"),
]
for attr in _urllib_parse_moved_attributes:
setattr(Module_six_moves_urllib_parse, attr.name, attr)
del attr
Module_six_moves_urllib_parse._moved_attributes = _urllib_parse_moved_attributes
_importer._add_module(Module_six_moves_urllib_parse(__name__ + ".moves.urllib_parse"),
"moves.urllib_parse", "moves.urllib.parse")
class Module_six_moves_urllib_error(_LazyModule):
_urllib_error_moved_attributes = [
MovedAttribute("URLError", "urllib2", "urllib.error"),
MovedAttribute("HTTPError", "urllib2", "urllib.error"),
MovedAttribute("ContentTooShortError", "urllib", "urllib.error"),
]
for attr in _urllib_error_moved_attributes:
setattr(Module_six_moves_urllib_error, attr.name, attr)
del attr
E-Commerce Website 55
SEA College Of Science, Commerce and Art’s
Module_six_moves_urllib_error._moved_attributes = _urllib_error_moved_attributes
_importer._add_module(Module_six_moves_urllib_error(__name__ + ".moves.urllib.error"),
"moves.urllib_error", "moves.urllib.error")
class Module_six_moves_urllib_request(_LazyModule):
_urllib_request_moved_attributes = [
MovedAttribute("urlopen", "urllib2", "urllib.request"),
MovedAttribute("install_opener", "urllib2", "urllib.request"),
MovedAttribute("build_opener", "urllib2", "urllib.request"),
MovedAttribute("pathname2url", "urllib", "urllib.request"),
MovedAttribute("url2pathname", "urllib", "urllib.request"),
MovedAttribute("getproxies", "urllib", "urllib.request"),
MovedAttribute("Request", "urllib2", "urllib.request"),
MovedAttribute("OpenerDirector", "urllib2", "urllib.request"),
MovedAttribute("HTTPDefaultErrorHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPRedirectHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPCookieProcessor", "urllib2", "urllib.request"),
MovedAttribute("ProxyHandler", "urllib2", "urllib.request"),
MovedAttribute("BaseHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPPasswordMgr", "urllib2", "urllib.request"),
MovedAttribute("HTTPPasswordMgrWithDefaultRealm", "urllib2", "urllib.request"),
MovedAttribute("AbstractBasicAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPBasicAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("ProxyBasicAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("AbstractDigestAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPDigestAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("ProxyDigestAuthHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPSHandler", "urllib2", "urllib.request"),
MovedAttribute("FileHandler", "urllib2", "urllib.request"),
MovedAttribute("FTPHandler", "urllib2", "urllib.request"),
MovedAttribute("CacheFTPHandler", "urllib2", "urllib.request"),
MovedAttribute("UnknownHandler", "urllib2", "urllib.request"),
MovedAttribute("HTTPErrorProcessor", "urllib2", "urllib.request"),
MovedAttribute("urlretrieve", "urllib", "urllib.request"),
MovedAttribute("urlcleanup", "urllib", "urllib.request"),
MovedAttribute("URLopener", "urllib", "urllib.request"),
MovedAttribute("FancyURLopener", "urllib", "urllib.request"),
MovedAttribute("proxy_bypass", "urllib", "urllib.request"),
MovedAttribute("parse_http_list", "urllib2", "urllib.request"),
MovedAttribute("parse_keqv_list", "urllib2", "urllib.request"),
]
for attr in _urllib_request_moved_attributes:
setattr(Module_six_moves_urllib_request, attr.name, attr)
del attr
Module_six_moves_urllib_request._moved_attributes = _urllib_request_moved_attributes
_importer._add_module(Module_six_moves_urllib_request(__name__ + ".moves.urllib.request"),
"moves.urllib_request", "moves.urllib.request")
class Module_six_moves_urllib_response(_LazyModule):
_urllib_response_moved_attributes = [
MovedAttribute("addbase", "urllib", "urllib.response"),
MovedAttribute("addclosehook", "urllib", "urllib.response"),
MovedAttribute("addinfo", "urllib", "urllib.response"),
MovedAttribute("addinfourl", "urllib", "urllib.response"),
]
for attr in _urllib_response_moved_attributes:
setattr(Module_six_moves_urllib_response, attr.name, attr)
del attr
Module_six_moves_urllib_response._moved_attributes = _urllib_response_moved_attributes
_importer._add_module(Module_six_moves_urllib_response(__name__ + ".moves.urllib.response"),
"moves.urllib_response", "moves.urllib.response")
E-Commerce Website 56
SEA College Of Science, Commerce and Art’s
class Module_six_moves_urllib_robotparser(_LazyModule):
_urllib_robotparser_moved_attributes = [
MovedAttribute("RobotFileParser", "robotparser", "urllib.robotparser"),
]
for attr in _urllib_robotparser_moved_attributes:
setattr(Module_six_moves_urllib_robotparser, attr.name, attr)
del attr
Module_six_moves_urllib_robotparser._moved_attributes = _urllib_robotparser_moved_attributes
_importer._add_module(Module_six_moves_urllib_robotparser(__name__ +
".moves.urllib.robotparser"),
"moves.urllib_robotparser", "moves.urllib.robotparser")
class Module_six_moves_urllib(types.ModuleType):
def __dir__(self):
return ['parse', 'error', 'request', 'response', 'robotparser']
_importer._add_module(Module_six_moves_urllib(__name__ + ".moves.urllib"),
"moves.urllib")
def add_move(move):
"""Add an item to six.moves."""
setattr(_MovedItems, move.name, move)
def remove_move(name):
"""Remove item from six.moves."""
try:
delattr(_MovedItems, name)
except AttributeError:
try:
del moves.__dict__[name]
except KeyError:
raise AttributeError("no such move, %r" % (name,))
if PY3:
_meth_func = "__func__"
_meth_self = "__self__"
_func_closure = "__closure__"
_func_code = "__code__"
_func_defaults = "__defaults__"
_func_globals = "__globals__"
else:
_meth_func = "im_func"
_meth_self = "im_self"
_func_closure = "func_closure"
_func_code = "func_code"
_func_defaults = "func_defaults"
_func_globals = "func_globals"
try:
advance_iterator = next
except NameError:
def advance_iterator(it):
return it.next()
next = advance_iterator
try:
callable = callable
except NameError:
E-Commerce Website 57
SEA College Of Science, Commerce and Art’s
def callable(obj):
return any("__call__" in klass.__dict__ for klass in type(obj).__mro__)
if PY3:
def get_unbound_function(unbound):
return unbound
create_bound_method = types.MethodType
Iterator = object
else:
def get_unbound_function(unbound):
return unbound.im_func
class Iterator(object):
def next(self):
return type(self).__next__(self)
callable = callable
_add_doc(get_unbound_function,
"""Get the function out of a possibly unbound function""")
get_method_function = operator.attrgetter(_meth_func)
get_method_self = operator.attrgetter(_meth_self)
get_function_closure = operator.attrgetter(_func_closure)
get_function_code = operator.attrgetter(_func_code)
get_function_defaults = operator.attrgetter(_func_defaults)
get_function_globals = operator.attrgetter(_func_globals)
if PY3:
def iterkeys(d, **kw):
return iter(d.keys(**kw))
viewkeys = operator.methodcaller("keys")
viewvalues = operator.methodcaller("values")
viewitems = operator.methodcaller("items")
else:
def iterkeys(d, **kw):
return d.iterkeys(**kw)
viewkeys = operator.methodcaller("viewkeys")
viewvalues = operator.methodcaller("viewvalues")
E-Commerce Website 58
SEA College Of Science, Commerce and Art’s
viewitems = operator.methodcaller("viewitems")
if PY3:
def b(s):
return s.encode("latin-1")
def u(s):
return s
unichr = chr
import struct
int2byte = struct.Struct(">B").pack
del struct
byte2int = operator.itemgetter(0)
indexbytes = operator.getitem
iterbytes = iter
import io
StringIO = io.StringIO
BytesIO = io.BytesIO
del io
_assertCountEqual = "assertCountEqual"
if sys.version_info[1] <= 1:
_assertRaisesRegex = "assertRaisesRegexp"
_assertRegex = "assertRegexpMatches"
_assertNotRegex = "assertNotRegexpMatches"
else:
_assertRaisesRegex = "assertRaisesRegex"
_assertRegex = "assertRegex"
_assertNotRegex = "assertNotRegex"
else:
def b(s):
return s
# Workaround for standalone backslash
def u(s):
return unicode(s.replace(r'\\', r'\\\\'), "unicode_escape")
unichr = unichr
int2byte = chr
def byte2int(bs):
return ord(bs[0])
if PY3:
exec_ = getattr(moves.builtins, "exec")
E-Commerce Website 59
SEA College Of Science, Commerce and Art’s
else:
def exec_(_code_, _globs_=None, _locs_=None):
"""Execute code in a namespace."""
if _globs_ is None:
frame = sys._getframe(1)
_globs_ = frame.f_globals
if _locs_ is None:
_locs_ = frame.f_locals
del frame
elif _locs_ is None:
_locs_ = _globs_
exec("""exec _code_ in _globs_, _locs_""")
def write(data):
if not isinstance(data, basestring):
data = str(data)
# If the file has an encoding, encode unicode with it.
if (isinstance(fp, file) and
isinstance(data, unicode) and
fp.encoding is not None):
errors = getattr(fp, "errors", None)
if errors is None:
errors = "strict"
data = data.encode(fp.encoding, errors)
fp.write(data)
want_unicode = False
sep = kwargs.pop("sep", None)
if sep is not None:
if isinstance(sep, unicode):
want_unicode = True
elif not isinstance(sep, str):
raise TypeError("sep must be None or a string")
end = kwargs.pop("end", None)
if end is not None:
if isinstance(end, unicode):
want_unicode = True
elif not isinstance(end, str):
E-Commerce Website 60
SEA College Of Science, Commerce and Art’s
else:
wraps = functools.wraps
E-Commerce Website 61
SEA College Of Science, Commerce and Art’s
@classmethod
def __prepare__(cls, name, this_bases):
return meta.__prepare__(name, bases)
return type.__new__(metaclass, 'temporary_class', (), {})
def add_metaclass(metaclass):
"""Class decorator for creating a class with a metaclass."""
def wrapper(cls):
orig_vars = cls.__dict__.copy()
slots = orig_vars.get('__slots__')
if slots is not None:
if isinstance(slots, str):
slots = [slots]
for slots_var in slots:
orig_vars.pop(slots_var)
orig_vars.pop('__dict__', None)
orig_vars.pop('__weakref__', None)
if hasattr(cls, '__qualname__'):
orig_vars['__qualname__'] = cls.__qualname__
return metaclass(cls.__name__, cls.__bases__, orig_vars)
return wrapper
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> encoded to `bytes`
- `bytes` -> `bytes`
"""
if isinstance(s, binary_type):
return s
if isinstance(s, text_type):
return s.encode(encoding, errors)
raise TypeError("not expecting type '%s'" % type(s))
For Python 2:
- `unicode` -> encoded to `str`
- `str` -> `str`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str`
"""
# Optimization: Fast return for the common case.
if type(s) is str:
return s
if PY2 and isinstance(s, text_type):
return s.encode(encoding, errors)
elif PY3 and isinstance(s, binary_type):
return s.decode(encoding, errors)
elif not isinstance(s, (text_type, binary_type)):
raise TypeError("not expecting type '%s'" % type(s))
return s
For Python 2:
- `unicode` -> `unicode`
- `str` -> `unicode`
For Python 3:
- `str` -> `str`
- `bytes` -> decoded to `str`
"""
if isinstance(s, binary_type):
return s.decode(encoding, errors)
E-Commerce Website 62
SEA College Of Science, Commerce and Art’s
def python_2_unicode_compatible(klass):
"""
A class decorator that defines __unicode__ and __str__ methods under Python 2.
Under Python 3 it does nothing.
To support Python 2 and 3 with a single code base, define a __str__ method
returning text and apply this decorator to the class.
"""
if PY2:
if '__str__' not in klass.__dict__:
raise ValueError("@python_2_unicode_compatible cannot be applied "
"to %s because it doesn't define __str__()." %
klass.__name__)
klass.__unicode__ = klass.__str__
klass.__str__ = lambda self: self.__unicode__().encode('utf-8')
return klass
deactivate () {
# reset old environment variables
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${_OLD_VIRTUAL_PATH:-}"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
PS1="${_OLD_VIRTUAL_PS1:-}"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
unset VIRTUAL_ENV_PROMPT
if [ ! "${1:-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
E-Commerce Website 63
SEA College Of Science, Commerce and Art’s
VIRTUAL_ENV="C:\Users\amalj\django_ecomerce_MVT\env"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/Scripts:$PATH"
export PATH
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
PS1="(env) ${PS1:-}"
export PS1
VIRTUAL_ENV_PROMPT="(env) "
export VIRTUAL_ENV_PROMPT
fi
deactivate () {
# reset old environment variables
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
PATH="${_OLD_VIRTUAL_PATH:-}"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
PS1="${_OLD_VIRTUAL_PS1:-}"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
unset VIRTUAL_ENV_PROMPT
if [ ! "${1:-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
VIRTUAL_ENV="C:\Users\amalj\django_ecomerce_MVT\env"
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/Scripts:$PATH"
export PATH
E-Commerce Website 64
SEA College Of Science, Commerce and Art’s
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1:-}"
PS1="(env) ${PS1:-}"
export PS1
VIRTUAL_ENV_PROMPT="(env) "
export VIRTUAL_ENV_PROMPT
fi
"""
Activate virtualenv for current interpreter:
This can be used when you must use an existing Python interpreter, not the virtualenv
bin/python.
""" # noqa: D415
from __future__ import annotations
import os
import site
import sys
try:
abs_file = os.path.abspath(__file__)
except NameError as exc:
msg = "You must use exec(open(this_file).read(), {'__file__': this_file}))"
raise AssertionError(msg) from exc
bin_dir = os.path.dirname(abs_file)
base = bin_dir[: -len("Scripts") - 1] # strip away the bin part from the __file__, plus the
path separator
# add the virtual environments libraries to the host python import mechanism
prev_length = len(sys.path)
for lib in "..\\Lib\\site-packages".split(os.pathsep):
path = os.path.realpath(os.path.join(bin_dir, lib))
site.addsitedir(path.decode("utf-8") if "" else path)
sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
sys.real_prefix = sys.prefix
sys.prefix = base
@echo off
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
set _OLD_CODEPAGE=%%a
)
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" 65001 > nul
)
set VIRTUAL_ENV=C:\Users\amalj\django_ecomerce_MVT\env
set _OLD_VIRTUAL_PROMPT=%PROMPT%
E-Commerce Website 65
SEA College Of Science, Commerce and Art’s
set PATH=%VIRTUAL_ENV%\Scripts;%PATH%
set VIRTUAL_ENV_PROMPT=(env)
:END
if defined _OLD_CODEPAGE (
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
set _OLD_CODEPAGE=
)
# This file must be used using `source bin/activate.fish` *within a running fish (
http://fishshell.com ) session*.
# Do not run it directly.
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
if test (echo $FISH_VERSION | head -c 1) -lt 3
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
else
set -gx PATH $_OLD_VIRTUAL_PATH
end
set -e _OLD_VIRTUAL_PATH
end
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
set -e _OLD_VIRTUAL_PYTHONHOME
end
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
and functions -q _old_fish_prompt
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using
`functions -e`.
set -l fish_function_path
set -e VIRTUAL_ENV
set -e VIRTUAL_ENV_PROMPT
E-Commerce Website 66
SEA College Of Science, Commerce and Art’s
deactivate nondestructive
if test -n ''
set -gx VIRTUAL_ENV_PROMPT ''
else
set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
end
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
function pydoc
python -m pydoc $argv
end
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
function fish_prompt
export-env {
def is-string [x] {
($x | describe) == 'string'
}
E-Commerce Website 67
SEA College Of Science, Commerce and Art’s
let new_env = {
$path_name : $new_path
VIRTUAL_ENV : $virtual_env
VIRTUAL_ENV_PROMPT : $virtual_env_prompt
}
$new_env | merge {
PROMPT_COMMAND : $new_prompt
VIRTUAL_PREFIX : $virtual_prefix
}
})
if defined _OLD_VIRTUAL_PROMPT (
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
)
set _OLD_VIRTUAL_PROMPT=
if defined _OLD_VIRTUAL_PYTHONHOME (
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
set _OLD_VIRTUAL_PYTHONHOME=
)
if defined _OLD_VIRTUAL_PATH (
set "PATH=%_OLD_VIRTUAL_PATH%"
)
set _OLD_VIRTUAL_PATH=
E-Commerce Website 68
SEA College Of Science, Commerce and Art’s
set VIRTUAL_ENV=
set VIRTUAL_ENV_PROMPT=
:END
Order
class Migration(migrations.Migration):
initial = True
dependencies = [
('shop', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Order',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('order_number', models.CharField(max_length=20)),
('first_name', models.CharField(max_length=50)),
('last_name', models.CharField(max_length=50)),
('phone', models.CharField(max_length=15)),
('email', models.EmailField(max_length=50)),
('address_line_1', models.CharField(max_length=50)),
('address_line_2', models.CharField(blank=True, max_length=50)),
('country', models.CharField(max_length=50)),
('state', models.CharField(max_length=50)),
('city', models.CharField(max_length=50)),
('order_note', models.CharField(blank=True, max_length=100)),
('order_total', models.FloatField()),
('tax', models.FloatField()),
('status', models.CharField(choices=[('New', 'New'), ('Accepted', 'Accepted'),
('Completed', 'Completed'), ('Cancelled', 'Cancelled')], default='New', max_length=10)),
('ip', models.CharField(blank=True, max_length=20)),
('is_ordered', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
],
),
migrations.CreateModel(
name='Payment',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('payment_id', models.CharField(max_length=100)),
('payment_method', models.CharField(max_length=100)),
('amount_paid', models.CharField(max_length=100)),
('status', models.CharField(max_length=100)),
('created_at', models.DateTimeField(auto_now_add=True)),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='OrderProduct',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('quantity', models.IntegerField()),
('product_price', models.FloatField()),
('ordered', models.BooleanField(default=False)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
E-Commerce Website 69
SEA College Of Science, Commerce and Art’s
('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='orders.order')),
('payment', models.ForeignKey(blank=True, null=True,
on_delete=django.db.models.deletion.SET_NULL, to='orders.payment')),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='shop.product')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL)),
('variations', models.ManyToManyField(blank=True, to='shop.Variation')),
],
),
migrations.AddField(
model_name='order',
name='payment',
field=models.ForeignKey(blank=True, null=True,
on_delete=django.db.models.deletion.SET_NULL, to='orders.payment'),
),
migrations.AddField(
model_name='order',
name='user',
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL,
to=settings.AUTH_USER_MODEL),
),
]
class OrderProductInline(admin.TabularInline):
model = OrderProduct
readonly_fields = ('payment', 'user', 'product', 'quantity', 'product_price', 'ordered')
extra = 0
class OrderAdmin(admin.ModelAdmin):
list_display = ['order_number', 'full_name', 'phone', 'email', 'city', 'order_total', 'tax',
'status', 'is_ordered', 'created_at']
list_filter = ['status', 'is_ordered']
search_fields = ['order_number', 'first_name', 'last_name', 'phone', 'email']
list_per_page = 20
inlines = [OrderProductInline]
admin.site.register(Payment)
admin.site.register(Order, OrderAdmin)
admin.site.register(OrderProduct)
from django.apps import AppConfig
class OrdersConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'orders'
class OrderForm(forms.ModelForm):
class Meta:
model = Order
fields = ['first_name', 'last_name', 'phone', 'email', 'address_line_1',
'address_line_2', 'country', 'state', 'city', 'order_note']
from django.db import models
from accounts.models import Account
from shop.models import Product, Variation
class Payment(models.Model):
user = models.ForeignKey(Account, on_delete=models.CASCADE)
payment_id = models.CharField(max_length=100)
payment_method = models.CharField(max_length=100)
amount_paid = models.CharField(max_length=100) # this is the total amount paid
status = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.payment_id
E-Commerce Website 70
SEA College Of Science, Commerce and Art’s
class Order(models.Model):
STATUS = (
('New', 'New'),
('Accepted', 'Accepted'),
('Completed', 'Completed'),
('Cancelled', 'Cancelled'),
)
def full_name(self):
return f'{self.first_name} {self.last_name}'
def full_address(self):
return f'{self.address_line_1} {self.address_line_2}'
def __str__(self):
return self.first_name
class OrderProduct(models.Model):
order = models.ForeignKey(Order, on_delete=models.CASCADE)
payment = models.ForeignKey(Payment, on_delete=models.SET_NULL, blank=True, null=True)
user = models.ForeignKey(Account, on_delete=models.CASCADE)
product = models.ForeignKey(Product, on_delete=models.CASCADE)
variations = models.ManyToManyField(Variation, blank=True)
quantity = models.IntegerField()
product_price = models.FloatField()
ordered = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.product.product_name
urlpatterns = [
path('place_order/', views.place_order, name='place_order'),
path('payments/', views.payments, name='payments'),
path('order_complete/', views.order_complete, name='order_complete'),
]
from django.shortcuts import render, redirect
from django.http import HttpResponse, JsonResponse
from cart.models import CartItem
from .forms import OrderForm
import datetime
from .models import Order, Payment, OrderProduct
import json
from shop.models import Product
from django.core.mail import EmailMessage
from django.template.loader import render_to_string
def payments(request):
body = json.loads(request.body)
E-Commerce Website 71
SEA College Of Science, Commerce and Art’s
order.payment = payment
order.is_ordered = True
order.save()
cart_item = CartItem.objects.get(id=item.id)
product_variation = cart_item.variations.all()
orderproduct = OrderProduct.objects.get(id=orderproduct.id)
orderproduct.variations.set(product_variation)
orderproduct.save()
# Clear cart
CartItem.objects.filter(user=request.user).delete()
# Send order number and transaction id back to sendData method via JsonResponse
data = {
'order_number': order.order_number,
'transID': payment.payment_id,
}
return JsonResponse(data)
# If the cart count is less than or equal to 0, then redirect back to shop
cart_items = CartItem.objects.filter(user=current_user)
cart_count = cart_items.count()
if cart_count <= 0:
return redirect('shop')
grand_total = 0
tax = 0
for cart_item in cart_items:
total += (cart_item.product.price * cart_item.quantity)
E-Commerce Website 72
SEA College Of Science, Commerce and Art’s
quantity += cart_item.quantity
tax = (2 * total)/100
grand_total = total + tax
if request.method == 'POST':
form = OrderForm(request.POST)
if form.is_valid():
# Store all the billing information inside Order table
data = Order()
data.user = current_user
data.first_name = form.cleaned_data['first_name']
data.last_name = form.cleaned_data['last_name']
data.phone = form.cleaned_data['phone']
data.email = form.cleaned_data['email']
data.address_line_1 = form.cleaned_data['address_line_1']
data.address_line_2 = form.cleaned_data['address_line_2']
data.country = form.cleaned_data['country']
data.state = form.cleaned_data['state']
data.city = form.cleaned_data['city']
data.order_note = form.cleaned_data['order_note']
data.order_total = grand_total
data.tax = tax
data.ip = request.META.get('REMOTE_ADDR')
data.save()
# Generate order number
yr = int(datetime.date.today().strftime('%Y'))
dt = int(datetime.date.today().strftime('%d'))
mt = int(datetime.date.today().strftime('%m'))
d = datetime.date(yr,mt,dt)
current_date = d.strftime("%Y%m%d") #20210305
order_number = current_date + str(data.id)
data.order_number = order_number
data.save()
def order_complete(request):
order_number = request.GET.get('order_number')
transID = request.GET.get('payment_id')
try:
order = Order.objects.get(order_number=order_number, is_ordered=True)
ordered_products = OrderProduct.objects.filter(order_id=order.id)
subtotal = 0
for i in ordered_products:
subtotal += i.product_price * i.quantity
payment = Payment.objects.get(payment_id=transID)
context = {
'order': order,
'ordered_products': ordered_products,
'order_number': order.order_number,
'transID': payment.payment_id,
'payment': payment,
'subtotal': subtotal,
}
return render(request, 'orders/order_complete.html', context)
except (Payment.DoesNotExist, Order.DoesNotExist):
return redirect('home')
Shop
E-Commerce Website 73
SEA College Of Science, Commerce and Art’s
class Migration(migrations.Migration):
initial = True
dependencies = [
('category', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Product',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('product_name', models.CharField(max_length=200, unique=True)),
('slug', models.SlugField(max_length=200, unique=True)),
('description', models.TextField(blank=True, max_length=500)),
('price', models.IntegerField()),
('images', models.ImageField(upload_to='photos/products')),
('stock', models.IntegerField()),
('is_available', models.BooleanField(default=True)),
('created_date', models.DateTimeField(auto_now_add=True)),
('modified_date', models.DateTimeField(auto_now=True)),
('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='category.category')),
],
),
migrations.CreateModel(
name='Variation',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('variation_category', models.CharField(choices=[('color', 'color'), ('size',
'size')], max_length=100)),
('variation_value', models.CharField(max_length=100)),
('is_active', models.BooleanField(default=True)),
('created_date', models.DateTimeField(auto_now=True)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='shop.product')),
],
),
migrations.CreateModel(
name='ReviewRating',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('subject', models.CharField(blank=True, max_length=100)),
('review', models.TextField(blank=True, max_length=500)),
('rating', models.FloatField()),
('ip', models.CharField(blank=True, max_length=20)),
('status', models.BooleanField(default=True)),
('created_at', models.DateTimeField(auto_now_add=True)),
('updated_at', models.DateTimeField(auto_now=True)),
('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to='shop.product')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='ProductGallery',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False,
verbose_name='ID')),
('image', models.ImageField(max_length=255, upload_to='store/products')),
E-Commerce Website 74
SEA College Of Science, Commerce and Art’s
('product', models.ForeignKey(default=None,
on_delete=django.db.models.deletion.CASCADE, to='shop.product')),
],
options={
'verbose_name': 'productgallery',
'verbose_name_plural': 'product gallery',
},
),
]
@admin_thumbnails.thumbnail('image')
class ProductGalleryInline(admin.TabularInline):
model = ProductGallery
extra = 1
class ProductAdmin(admin.ModelAdmin):
list_display = ('product_name', 'price', 'stock', 'category', 'modified_date',
'is_available')
prepopulated_fields = {'slug': ('product_name',)}
inlines = [ProductGalleryInline]
class VariationAdmin(admin.ModelAdmin):
list_display = ('product', 'variation_category', 'variation_value', 'is_active')
list_editable = ('is_active',)
list_filter = ('product', 'variation_category', 'variation_value')
admin.site.register(Product, ProductAdmin)
admin.site.register(Variation, VariationAdmin)
admin.site.register(ReviewRating)
admin.site.register(ProductGallery)
from django import forms
from .models import ReviewRating
class ReviewForm(forms.ModelForm):
class Meta:
model = ReviewRating
fields = ['subject', 'review', 'rating']
from django.db import models
from category.models import Category
from django.urls import reverse
from accounts.models import Account
from django.db.models import Avg, Count
class Product(models.Model):
product_name = models.CharField(max_length=200, unique=True)
slug = models.SlugField(max_length=200, unique=True)
description = models.TextField(max_length=500, blank=True)
price = models.IntegerField()
images = models.ImageField(upload_to='photos/products')
stock = models.IntegerField()
is_available = models.BooleanField(default=True)
category = models.ForeignKey(Category, on_delete=models.CASCADE)
created_date = models.DateTimeField(auto_now_add=True)
modified_date = models.DateTimeField(auto_now=True)
def get_url(self):
return reverse('product_detail', args=[self.category.slug, self.slug])
def __str__(self):
return self.product_name
def averageReview(self):
reviews = ReviewRating.objects.filter(product=self,
status=True).aggregate(average=Avg('rating'))
avg = 0
if reviews['average'] is not None:
avg = float(reviews['average'])
return avg
E-Commerce Website 75
SEA College Of Science, Commerce and Art’s
def countReview(self):
reviews = ReviewRating.objects.filter(product=self,
status=True).aggregate(count=Count('id'))
count = 0
if reviews['count'] is not None:
count = int(reviews['count'])
return count
class VariationManager(models.Manager):
def colors(self):
return super(VariationManager, self).filter(variation_category='color', is_active=True)
def sizes(self):
return super(VariationManager, self).filter(variation_category='size', is_active=True)
variation_category_choice = (
('color', 'color'),
('size', 'size'),
)
class Variation(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE)
variation_category = models.CharField(max_length=100, choices=variation_category_choice)
variation_value = models.CharField(max_length=100)
is_active = models.BooleanField(default=True)
created_date = models.DateTimeField(auto_now=True)
objects = VariationManager()
def __str__(self):
return self.variation_value
class ReviewRating(models.Model):
product = models.ForeignKey(Product, on_delete=models.CASCADE)
user = models.ForeignKey(Account, on_delete=models.CASCADE)
subject = models.CharField(max_length=100, blank=True)
review = models.TextField(max_length=500, blank=True)
rating = models.FloatField()
ip = models.CharField(max_length=20, blank=True)
status = models.BooleanField(default=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.subject
class ProductGallery(models.Model):
product = models.ForeignKey(Product, default=None, on_delete=models.CASCADE)
image = models.ImageField(upload_to='store/products', max_length=255)
def __str__(self):
return self.product.product_name
class Meta:
verbose_name = 'productgallery'
verbose_name_plural = 'product gallery'
from django.urls import path
from . import views
urlpatterns = [
path('', views.store, name='store'),
path('category/<slug:category_slug>/', views.store, name='products_by_category'),
path('category/<slug:category_slug>/<slug:product_slug>/', views.product_detail,
name='product_detail'),
path('search/', views.search, name='search'),
path('submit_review/<int:product_id>/', views.submit_review, name='submit_review'),
]
from django.shortcuts import render, get_object_or_404, redirect
from .models import Product, ReviewRating, ProductGallery
from category.models import Category
from cart.models import CartItem
from django.db.models import Q
E-Commerce Website 76
SEA College Of Science, Commerce and Art’s
if category_slug != None:
categories = get_object_or_404(Category, slug=category_slug)
products = Product.objects.filter(category=categories, is_available=True)
paginator = Paginator(products, 1)
page = request.GET.get('page')
paged_products = paginator.get_page(page)
product_count = products.count()
else:
products = Product.objects.all().filter(is_available=True).order_by('id')
paginator = Paginator(products, 3)
page = request.GET.get('page')
paged_products = paginator.get_page(page)
product_count = products.count()
context = {
'products': paged_products,
'product_count': product_count,
}
return render(request, 'store/store.html', context)
if request.user.is_authenticated:
try:
orderproduct = OrderProduct.objects.filter(user=request.user,
product_id=single_product.id).exists()
except OrderProduct.DoesNotExist:
orderproduct = None
else:
orderproduct = None
context = {
'single_product': single_product,
'in_cart' : in_cart,
'orderproduct': orderproduct,
'reviews': reviews,
'product_gallery': product_gallery,
}
return render(request, 'store/product_detail.html', context)
def search(request):
if 'keyword' in request.GET:
keyword = request.GET['keyword']
if keyword:
products = Product.objects.order_by('-
created_date').filter(Q(description__icontains=keyword) | Q(product_name__icontains=keyword))
product_count = products.count()
context = {
'products': products,
'product_count': product_count,
}
E-Commerce Website 77
SEA College Of Science, Commerce and Art’s
Static
.select2-container {
box-sizing: border-box;
display: inline-block;
margin: 0;
position: relative;
vertical-align: middle; }
.select2-container .select2-selection--single {
box-sizing: border-box;
cursor: pointer;
display: block;
height: 28px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--single .select2-selection__rendered {
display: block;
padding-left: 8px;
padding-right: 20px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-selection--single .select2-selection__clear {
position: relative; }
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
padding-right: 8px;
padding-left: 20px; }
.select2-container .select2-selection--multiple {
box-sizing: border-box;
cursor: pointer;
display: block;
min-height: 32px;
user-select: none;
-webkit-user-select: none; }
.select2-container .select2-selection--multiple .select2-selection__rendered {
display: inline-block;
overflow: hidden;
padding-left: 8px;
text-overflow: ellipsis;
white-space: nowrap; }
.select2-container .select2-search--inline {
float: left; }
.select2-container .select2-search--inline .select2-search__field {
box-sizing: border-box;
border: none;
font-size: 100%;
margin-top: 5px;
padding: 0; }
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-
button {
E-Commerce Website 78
SEA College Of Science, Commerce and Art’s
-webkit-appearance: none; }
.select2-dropdown {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
box-sizing: border-box;
display: block;
position: absolute;
left: -100000px;
width: 100%;
z-index: 1051; }
.select2-results {
display: block; }
.select2-results__options {
list-style: none;
margin: 0;
padding: 0; }
.select2-results__option {
padding: 6px;
user-select: none;
-webkit-user-select: none; }
.select2-results__option[aria-selected] {
cursor: pointer; }
.select2-container--open .select2-dropdown {
left: 0; }
.select2-container--open .select2-dropdown--above {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--open .select2-dropdown--below {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-search--dropdown {
display: block;
padding: 4px; }
.select2-search--dropdown .select2-search__field {
padding: 4px;
width: 100%;
box-sizing: border-box; }
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
-webkit-appearance: none; }
.select2-search--dropdown.select2-search--hide {
display: none; }
.select2-close-mask {
border: 0;
margin: 0;
padding: 0;
display: block;
position: fixed;
left: 0;
top: 0;
min-height: 100%;
min-width: 100%;
height: auto;
width: auto;
opacity: 0;
z-index: 99;
background-color: #fff;
filter: alpha(opacity=0); }
.select2-hidden-accessible {
border: 0 !important;
clip: rect(0 0 0 0) !important;
-webkit-clip-path: inset(50%) !important;
E-Commerce Website 79
SEA College Of Science, Commerce and Art’s
.select2-container--default .select2-selection--single {
background-color: #fff;
border: 1px solid #aaa;
border-radius: 4px; }
.select2-container--default .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 28px; }
.select2-container--default .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold; }
.select2-container--default .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--default .select2-selection--single .select2-selection__arrow {
height: 26px;
position: absolute;
top: 1px;
right: 1px;
width: 20px; }
.select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--default.select2-container--disabled .select2-selection--single {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection--single .select2-
selection__clear {
display: none; }
.select2-container--default .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
cursor: text; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
box-sizing: border-box;
list-style: none;
margin: 0;
padding: 0 5px;
width: 100%; }
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
list-style: none; }
.select2-container--default .select2-selection--multiple .select2-selection__clear {
cursor: pointer;
float: right;
E-Commerce Website 80
SEA College Of Science, Commerce and Art’s
font-weight: bold;
margin-top: 5px;
margin-right: 10px;
padding: 1px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px; }
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
color: #999;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--default .select2-selection--multiple .select2-
selection__choice__remove:hover {
color: #333; }
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: solid black 1px;
outline: 0; }
.select2-container--default.select2-container--disabled .select2-selection--multiple {
background-color: #eee;
cursor: default; }
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
display: none; }
.select2-container--default.select2-container--open.select2-container--above .select2-selection-
-single, .select2-container--default.select2-container--open.select2-container--above .select2-
selection--multiple {
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--default.select2-container--open.select2-container--below .select2-selection-
-single, .select2-container--default.select2-container--open.select2-container--below .select2-
selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--default .select2-results__option[role=group] {
E-Commerce Website 81
SEA College Of Science, Commerce and Art’s
padding: 0; }
.select2-container--default .select2-results__option[aria-disabled=true] {
color: #999; }
.select2-container--default .select2-results__option[aria-selected=true] {
background-color: #ddd; }
.select2-container--default .select2-results__option--highlighted[aria-selected] {
background-color: #5897fb;
color: white; }
.select2-container--default .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
.select2-container--classic .select2-selection--single {
background-color: #f7f7f7;
border: 1px solid #aaa;
border-radius: 4px;
outline: 0;
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',
endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic .select2-selection--single:focus {
border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--single .select2-selection__rendered {
color: #444;
line-height: 28px; }
.select2-container--classic .select2-selection--single .select2-selection__clear {
cursor: pointer;
float: right;
font-weight: bold;
margin-right: 10px; }
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
color: #999; }
.select2-container--classic .select2-selection--single .select2-selection__arrow {
background-color: #ddd;
border: none;
border-left: 1px solid #aaa;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
height: 26px;
E-Commerce Website 82
SEA College Of Science, Commerce and Art’s
position: absolute;
top: 1px;
right: 1px;
width: 20px;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',
endColorstr='#FFCCCCCC', GradientType=0); }
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
border-color: #888 transparent transparent transparent;
border-style: solid;
border-width: 5px 4px 0 4px;
height: 0;
left: 50%;
margin-left: -4px;
margin-top: -2px;
position: absolute;
top: 50%;
width: 0; }
.select2-container--classic.select2-container--open .select2-selection--single {
border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-
selection__arrow {
background: transparent;
border: none; }
.select2-container--classic.select2-container--open .select2-selection--single .select2-
selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection-
-single {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF',
endColorstr='#FFEEEEEE', GradientType=0); }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection-
-single {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE',
endColorstr='#FFFFFFFF', GradientType=0); }
.select2-container--classic .select2-selection--multiple {
background-color: white;
border: 1px solid #aaa;
border-radius: 4px;
cursor: text;
E-Commerce Website 83
SEA College Of Science, Commerce and Art’s
outline: 0; }
.select2-container--classic .select2-selection--multiple:focus {
border: 1px solid #5897fb; }
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
list-style: none;
margin: 0;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
display: none; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
background-color: #e4e4e4;
border: 1px solid #aaa;
border-radius: 4px;
cursor: default;
float: left;
margin-right: 5px;
margin-top: 5px;
padding: 0 5px; }
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
color: #888;
cursor: pointer;
display: inline-block;
font-weight: bold;
margin-right: 2px; }
.select2-container--classic .select2-selection--multiple .select2-
selection__choice__remove:hover {
color: #555; }
.select2-container--classic.select2-container--open .select2-selection--multiple {
border: 1px solid #5897fb; }
.select2-container--classic.select2-container--open.select2-container--above .select2-selection-
-multiple {
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0; }
.select2-container--classic.select2-container--open.select2-container--below .select2-selection-
-multiple {
border-bottom: none;
border-bottom-left-radius: 0;
border-bottom-right-radius: 0; }
.select2-container--classic .select2-dropdown {
background-color: white;
border: 1px solid transparent; }
.select2-container--classic .select2-dropdown--above {
border-bottom: none; }
.select2-container--classic .select2-dropdown--below {
border-top: none; }
E-Commerce Website 84
SEA College Of Science, Commerce and Art’s
.select2-container--classic .select2-results__option[role=group] {
padding: 0; }
.select2-container--classic .select2-results__option[aria-disabled=true] {
color: grey; }
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
background-color: #3875d7;
color: white; }
.select2-container--classic .select2-results__group {
cursor: default;
display: block;
padding: 6px; }
select.admin-autocomplete {
width: 20em;
}
.select2-container--admin-autocomplete.select2-container {
min-height: 30px;
}
.select2-container--admin-autocomplete .select2-selection--single,
.select2-container--admin-autocomplete .select2-selection--multiple {
min-height: 30px;
padding: 0;
}
.select2-container--admin-autocomplete.select2-container--focus .select2-selection,
.select2-container--admin-autocomplete.select2-container--open .select2-selection {
border-color: var(--body-quiet-color);
min-height: 30px;
}
.select2-container--admin-autocomplete.select2-container--focus .select2-selection.select2-
selection--single,
.select2-container--admin-autocomplete.select2-container--open .select2-selection.select2-
selection--single {
padding: 0;
}
.select2-container--admin-autocomplete.select2-container--focus .select2-selection.select2-
selection--multiple,
.select2-container--admin-autocomplete.select2-container--open .select2-selection.select2-
selection--multiple {
padding: 0;
}
.select2-container--admin-autocomplete .select2-selection--single {
background-color: var(--body-bg);
border: 1px solid var(--border-color);
border-radius: 4px;
}
E-Commerce Website 85
SEA College Of Science, Commerce and Art’s
position: absolute;
top: 1px;
right: 1px;
width: 20px;
}
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection--single {
background-color: var(--darkened-bg);
cursor: default;
}
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection--single
.select2-selection__clear {
display: none;
}
.select2-container--admin-autocomplete.select2-container--open .select2-selection--single
.select2-selection__arrow b {
border-color: transparent transparent #888 transparent;
border-width: 0 4px 5px 4px;
}
.select2-container--admin-autocomplete .select2-selection--multiple {
background-color: var(--body-bg);
border: 1px solid var(--border-color);
border-radius: 4px;
cursor: text;
}
E-Commerce Website 86
SEA College Of Science, Commerce and Art’s
.select2-container--admin-autocomplete.select2-container--focus .select2-selection--multiple {
border: solid var(--body-quiet-color) 1px;
outline: 0;
}
.select2-container--admin-autocomplete.select2-container--disabled .select2-selection--multiple
{
background-color: var(--darkened-bg);
cursor: default;
}
.select2-container--admin-autocomplete.select2-container--disabled .select2-
selection__choice__remove {
display: none;
}
.select2-container--admin-autocomplete.select2-container--open.select2-container--above
.select2-selection--single, .select2-container--admin-autocomplete.select2-container--
open.select2-container--above .select2-selection--multiple {
border-top-left-radius: 0;
E-Commerce Website 87
SEA College Of Science, Commerce and Art’s
border-top-right-radius: 0;
}
.select2-container--admin-autocomplete.select2-container--open.select2-container--below
.select2-selection--single, .select2-container--admin-autocomplete.select2-container--
open.select2-container--below .select2-selection--multiple {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.select2-container--admin-autocomplete .select2-search--dropdown {
background: var(--darkened-bg);
}
.select2-container--admin-autocomplete .select2-results__option[role=group] {
padding: 0;
}
.select2-container--admin-autocomplete .select2-results__option[aria-disabled=true] {
color: var(--body-quiet-color);
}
.select2-container--admin-autocomplete .select2-results__option[aria-selected=true] {
background-color: var(--selected-bg);
color: var(--body-fg);
}
E-Commerce Website 88
SEA College Of Science, Commerce and Art’s
padding-left: 4em;
}
.select2-container--admin-autocomplete .select2-results__option--highlighted[aria-selected] {
background-color: var(--primary);
color: var(--primary-fg);
}
.select2-container--admin-autocomplete .select2-results__group {
cursor: default;
display: block;
padding: 6px;
}
/*
DJANGO Admin styles
*/
@import url(fonts.css);
/* VARIABLE DEFINITIONS */
:root {
--primary: #79aec8;
--secondary: #417690;
--accent: #f5dd5d;
--primary-fg: #fff;
--body-fg: #333;
--body-bg: #fff;
--body-quiet-color: #666;
--body-loud-color: #000;
--header-color: #ffc;
--header-branding-color: var(--accent);
--header-bg: var(--secondary);
--header-link-color: var(--primary-fg);
--breadcrumbs-fg: #c4dce8;
--breadcrumbs-link-fg: var(--body-bg);
--breadcrumbs-bg: var(--primary);
--link-fg: #447e9b;
--link-hover-color: #036;
--link-selected-fg: #5b80b2;
--hairline-color: #e8e8e8;
--border-color: #ccc;
--error-fg: #ba2121;
--message-success-bg: #dfd;
--message-warning-bg: #ffc;
--message-error-bg: #ffefef;
--button-fg: #fff;
--button-bg: var(--primary);
E-Commerce Website 89
SEA College Of Science, Commerce and Art’s
--button-hover-bg: #609ab6;
--default-button-bg: var(--secondary);
--default-button-hover-bg: #205067;
--close-button-bg: #888; /* Previously #bbb, contrast 1.92 */
--close-button-hover-bg: #747474;
--delete-button-bg: #ba2121;
--delete-button-hover-bg: #a41515;
--object-tools-fg: var(--button-fg);
--object-tools-bg: var(--close-button-bg);
--object-tools-hover-bg: var(--close-button-hover-bg);
}
html, body {
height: 100%;
}
body {
margin: 0;
padding: 0;
font-size: 0.875rem;
font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera
Sans",Verdana,Arial,sans-serif;
color: var(--body-fg);
background: var(--body-bg);
}
/* LINKS */
a:link, a:visited {
color: var(--link-fg);
text-decoration: none;
transition: color 0.15s, background 0.15s;
}
a:focus, a:hover {
color: var(--link-hover-color);
}
a:focus {
text-decoration: underline;
}
a img {
border: none;
}
a.section:link, a.section:visited {
color: var(--header-link-color);
text-decoration: none;
}
a.section:focus, a.section:hover {
text-decoration: underline;
}
/* GLOBAL DEFAULTS */
p, ol, ul, dl {
margin: .2em 0 .8em 0;
}
p {
padding: 0;
line-height: 140%;
}
h1,h2,h3,h4,h5 {
font-weight: bold;
}
h1 {
margin: 0 0 20px;
font-weight: 300;
E-Commerce Website 90
SEA College Of Science, Commerce and Art’s
font-size: 1.25rem;
color: var(--body-quiet-color);
}
h2 {
font-size: 1rem;
margin: 1em 0 .5em 0;
}
h2.subhead {
font-weight: normal;
margin-top: 0;
}
h3 {
font-size: 0.875rem;
margin: .8em 0 .3em 0;
color: var(--body-quiet-color);
font-weight: bold;
}
h4 {
font-size: 0.75rem;
margin: 1em 0 .8em 0;
padding-bottom: 3px;
}
h5 {
font-size: 0.625rem;
margin: 1.5em 0 .5em 0;
color: var(--body-quiet-color);
text-transform: uppercase;
letter-spacing: 1px;
}
ul > li {
list-style-type: square;
padding: 1px 0;
}
li ul {
margin-bottom: 0;
}
li, dt, dd {
font-size: 0.8125rem;
line-height: 20px;
}
dt {
font-weight: bold;
margin-top: 4px;
}
dd {
margin-left: 0;
}
form {
margin: 0;
padding: 0;
}
fieldset {
margin: 0;
min-width: 0;
padding: 0;
border: none;
border-top: 1px solid var(--hairline-color);
}
blockquote {
font-size: 0.6875rem;
color: #777;
E-Commerce Website 91
SEA College Of Science, Commerce and Art’s
margin-left: 2px;
padding-left: 10px;
border-left: 5px solid #ddd;
}
code, pre {
font-family: "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace;
color: var(--body-quiet-color);
font-size: 0.75rem;
overflow-x: auto;
}
pre.literal-block {
margin: 10px;
background: var(--darkened-bg);
padding: 6px 8px;
}
code strong {
color: #930;
}
hr {
clear: both;
color: var(--hairline-color);
background-color: var(--hairline-color);
height: 1px;
border: none;
margin: 0;
padding: 0;
line-height: 1px;
}
.small {
font-size: 0.6875rem;
}
.mini {
font-size: 0.625rem;
}
div.help ul {
margin-bottom: 0;
}
.help-tooltip {
cursor: help;
}
.clear {
clear: both;
}
.nowrap {
white-space: nowrap;
}
.hidden {
E-Commerce Website 92
SEA College Of Science, Commerce and Art’s
/* TABLES */
table {
border-collapse: collapse;
border-color: var(--border-color);
}
td, th {
font-size: 0.8125rem;
line-height: 16px;
border-bottom: 1px solid var(--hairline-color);
vertical-align: top;
padding: 8px;
}
th {
font-weight: 600;
text-align: left;
}
thead th,
tfoot td {
color: var(--body-quiet-color);
padding: 5px 10px;
font-size: 0.6875rem;
background: var(--body-bg);
border: none;
border-top: 1px solid var(--hairline-color);
border-bottom: 1px solid var(--hairline-color);
}
tfoot td {
border-bottom: none;
border-top: 1px solid var(--hairline-color);
}
thead th.required {
color: var(--body-loud-color);
}
tr.alt {
background: var(--darkened-bg);
}
tr:nth-child(odd), .row-form-errors {
background: var(--body-bg);
}
tr:nth-child(even),
tr:nth-child(even) .errorlist,
tr:nth-child(odd) + .row-form-errors,
tr:nth-child(odd) + .row-form-errors .errorlist {
background: var(--darkened-bg);
}
/* SORTABLE TABLES */
thead th {
padding: 5px 10px;
line-height: normal;
text-transform: uppercase;
background: var(--darkened-bg);
}
thead th.sorted {
background: var(--selected-bg);
}
E-Commerce Website 93
SEA College Of Science, Commerce and Art’s
E-Commerce Website 94
SEA College Of Science, Commerce and Art’s
/* FORM DEFAULTS */
textarea {
vertical-align: top;
}
select {
height: 30px;
}
select[multiple] {
/* Allow HTML size attribute to override the height in the rule above. */
height: auto;
min-height: 150px;
}
/* FORM BUTTONS */
E-Commerce Website 95
SEA College Of Science, Commerce and Art’s
a.button {
padding: 4px 5px;
}
.button.default:active, input[type=submit].default:active,
.button.default:focus, input[type=submit].default:focus,
.button.default:hover, input[type=submit].default:hover {
background: var(--default-button-hover-bg);
}
.button[disabled].default,
input[type=submit][disabled].default,
input[type=button][disabled].default {
opacity: 0.4;
}
/* MODULES */
.module {
border: none;
margin-bottom: 30px;
background: var(--body-bg);
}
.module p, .module ul, .module h3, .module h4, .module dl, .module pre {
padding-left: 10px;
padding-right: 10px;
}
.module blockquote {
margin-left: 12px;
}
.module h3 {
margin-top: .6em;
}
.module caption,
.inline-group h2 {
font-size: 0.75rem;
letter-spacing: 0.5px;
text-transform: uppercase;
}
E-Commerce Website 96
SEA College Of Science, Commerce and Art’s
.module table {
border-collapse: collapse;
}
ul.messagelist {
padding: 0;
margin: 0;
}
ul.messagelist li {
display: block;
font-weight: 400;
font-size: 0.8125rem;
padding: 10px 10px 10px 65px;
margin: 0 0 10px 0;
background: var(--message-success-bg) url(../img/icon-yes.svg) 40px 12px no-repeat;
background-size: 16px auto;
color: var(--body-fg);
word-break: break-word;
}
ul.messagelist li.warning {
background: var(--message-warning-bg) url(../img/icon-alert.svg) 40px 14px no-repeat;
background-size: 14px auto;
}
ul.messagelist li.error {
background: var(--message-error-bg) url(../img/icon-no.svg) 40px 12px no-repeat;
background-size: 16px auto;
}
.errornote {
font-size: 0.875rem;
font-weight: 700;
display: block;
padding: 10px 12px;
margin: 0 0 10px 0;
color: var(--error-fg);
border: 1px solid var(--error-fg);
border-radius: 4px;
background-color: var(--body-bg);
background-position: 5px 12px;
overflow-wrap: break-word;
}
ul.errorlist {
margin: 0 0 4px;
padding: 0;
color: var(--error-fg);
background: var(--body-bg);
}
ul.errorlist li {
font-size: 0.8125rem;
display: block;
margin-bottom: 4px;
overflow-wrap: break-word;
}
ul.errorlist li:first-child {
margin-top: 0;
}
ul.errorlist li a {
color: inherit;
text-decoration: underline;
}
td ul.errorlist {
margin: 0;
padding: 0;
}
E-Commerce Website 97
SEA College Of Science, Commerce and Art’s
td ul.errorlist li {
margin: 0;
}
.form-row.errors {
margin: 0;
border: none;
border-bottom: 1px solid var(--hairline-color);
background: none;
}
.form-row.errors ul.errorlist li {
padding-left: 0;
}
.description {
font-size: 0.75rem;
padding: 5px 0 0 12px;
}
/* BREADCRUMBS */
div.breadcrumbs {
background: var(--breadcrumbs-bg);
padding: 10px 40px;
border: none;
color: var(--breadcrumbs-fg);
text-align: left;
}
div.breadcrumbs a {
color: var(--breadcrumbs-link-fg);
}
/* ACTION ICONS *
.viewlink, .inlineviewlink {
padding-left: 16px;
background: url(../img/icon-viewlink.svg) 0 1px no-repeat;
}
.addlink {
padding-left: 16px;
background: url(../img/icon-addlink.svg) 0 1px no-repeat;
}
.changelink, .inlinechangelink {
padding-left: 16px;
background: url(../img/icon-changelink.svg) 0 1px no-repeat;
}
.deletelink {
padding-left: 16px;
background: url(../img/icon-deletelink.svg) 0 1px no-repeat;
}
a.deletelink:link, a.deletelink:visited {
color: #CC3434; /* XXX Probably unused? */
}
a.deletelink:focus, a.deletelink:hover {
color: #993333; /* XXX Probably unused? */
text-decoration: none;
}
E-Commerce Website 98
SEA College Of Science, Commerce and Art’s
/* OBJECT TOOLS */
.object-tools {
font-size: 0.625rem;
font-weight: bold;
padding-left: 0;
float: right;
position: relative;
margin-top: -48px;
}
.object-tools li {
display: block;
float: left;
margin-left: 5px;
height: 16px;
}
.object-tools a {
border-radius: 15px;
}
.object-tools a:focus{
text-decoration: none;
}
.object-tools a.viewsitelink {
background-image: url(../img/tooltag-arrowright.svg);
}
.object-tools a.addlink {
background-image: url(../img/tooltag-add.svg);
}
/* OBJECT HISTORY */
#change-history table {
width: 100%;
}
#change-history .paginator {
color: var(--body-quiet-color);
border-bottom: 1px solid var(--hairline-color);
background: var(--body-bg);
overflow: hidden;
}
/* PAGE STRUCTURE */
E-Commerce Website 99
SEA College Of Science, Commerce and Art’s
#container {
position: relative;
width: 100%;
min-width: 980px;
padding: 0;
display: flex;
flex-direction: column;
height: 100%;
}
#content {
padding: 20px 40px;
}
.dashboard #content {
width: 600px;
}
#content-main {
float: left;
width: 100%;
}
#content-related {
float: right;
width: 260px;
position: relative;
margin-right: -300px;
}
#footer {
clear: both;
padding: 10px;
}
/* COLUMN TYPES */
.colMS {
margin-right: 300px;
}
.colSM {
margin-left: 300px;
}
.colSM #content-related {
float: left;
margin-right: 0;
margin-left: -300px;
}
.colSM #content-main {
float: right;
}
.popup .colM {
width: auto;
}
/* HEADER */
#header {
width: auto;
height: auto;
display: flex;
justify-content: space-between;
align-items: center;
padding: 10px 40px;
background: var(--header-bg);
color: var(--header-color);
overflow: hidden;
}
#branding {
float: left;
}
#branding h1 {
padding: 0;
margin: 0 20px 0 0;
font-weight: 300;
font-size: 1.5rem;
color: var(--header-branding-color);
}
#branding h2 {
padding: 0 10px;
font-size: 0.875rem;
margin: -8px 0 8px 0;
font-weight: normal;
color: var(--header-color);
}
#branding a:hover {
text-decoration: none;
}
#logout-form {
display: inline;
}
#logout-form button {
background: none;
border: 0;
cursor: pointer;
font-family: "Roboto","Lucida Grande","DejaVu Sans","Bitstream Vera
Sans",Verdana,Arial,sans-serif;
}
#user-tools {
float: right;
margin: 0 0 0 20px;
text-align: right;
}
/* SIDEBAR */
#content-related {
background: var(--darkened-bg);
}
#content-related .module {
background: none;
}
#content-related h3 {
color: var(--body-quiet-color);
padding: 0 16px;
margin: 0 0 16px;
}
#content-related h4 {
font-size: 0.8125rem;
}
#content-related p {
padding-left: 16px;
padding-right: 16px;
}
#content-related .actionlist {
padding: 0;
margin: 16px;
}
#content-related .actionlist li {
line-height: 1.2;
margin-bottom: 10px;
padding-left: 18px;
}
#content-related .module h2 {
background: none;
padding: 16px;
margin-bottom: 16px;
border-bottom: 1px solid var(--hairline-color);
font-size: 1.125rem;
color: var(--body-fg);
}
vertical-align: middle;
height: 15px;
line-height: 15px;
border-radius: 4px;
padding: 10px 15px;
color: var(--button-fg);
background: var(--close-button-bg);
margin: 0 0 0 10px;
}
/* POPUP */
.popup #content {
padding: 20px;
}
.popup #container {
min-width: 0;
}
.popup #header {
padding: 10px 20px;
}
/* PAGINATOR */
.paginator {
font-size: 0.8125rem;
padding-top: 10px;
padding-bottom: 10px;
line-height: 22px;
margin: 0;
border-top: 1px solid var(--hairline-color);
width: 100%;
}
.paginator a.showall {
border: none;
background: none;
color: var(--link-fg);
}
.paginator .end {
margin-right: 6px;
}
.paginator .this-page {
padding: 2px 6px;
font-weight: bold;
font-size: 0.8125rem;
vertical-align: top;
}
/* CHANGELISTS */
#changelist {
display: flex;
align-items: flex-start;
justify-content: space-between;
}
#changelist .changelist-form-container {
flex: 1 1 auto;
min-width: 0;
}
#changelist table {
width: 100%;
}
.change-list .filtered {
min-height: 400px;
}
#changelist-form .results {
overflow-x: auto;
width: 100%;
}
#changelist .toplinks {
border-bottom: 1px solid var(--hairline-color);
}
#changelist .paginator {
color: var(--body-quiet-color);
border-bottom: 1px solid var(--hairline-color);
background: var(--body-bg);
overflow: hidden;
}
/* CHANGELIST TABLES */
/* TOOLBAR */
#toolbar {
padding: 8px 10px;
margin-bottom: 15px;
border-top: 1px solid var(--hairline-color);
border-bottom: 1px solid var(--hairline-color);
background: var(--darkened-bg);
color: var(--body-quiet-color);
}
#toolbar #searchbar {
height: 19px;
border: 1px solid var(--border-color);
padding: 2px 5px;
margin: 0;
vertical-align: top;
font-size: 0.8125rem;
max-width: 100%;
}
#toolbar #searchbar:focus {
border-color: var(--body-quiet-color);
}
#changelist-search img {
vertical-align: middle;
margin-right: 4px;
}
#changelist-search .help {
word-break: break-word;
}
/* FILTER COLUMN */
#changelist-filter {
flex: 0 0 240px;
order: 1;
background: var(--darkened-bg);
border-left: none;
margin: 0 0 0 30px;
}
#changelist-filter h2 {
font-size: 0.875rem;
text-transform: uppercase;
letter-spacing: 0.5px;
padding: 5px 15px;
margin-bottom: 12px;
border-bottom: none;
}
#changelist-filter h3,
#changelist-filter details summary {
font-weight: 400;
padding: 0 15px;
margin-bottom: 10px;
}
#changelist-filter ul {
margin: 5px 0;
padding: 0 15px 15px;
border-bottom: 1px solid var(--hairline-color);
}
#changelist-filter ul:last-child {
border-bottom: none;
}
#changelist-filter li {
list-style-type: none;
margin-left: 0;
padding-left: 0;
}
#changelist-filter a {
display: block;
color: var(--body-quiet-color);
word-break: break-word;
}
#changelist-filter li.selected {
border-left: 5px solid var(--hairline-color);
padding-left: 10px;
margin-left: -15px;
}
#changelist-filter li.selected a {
color: var(--link-selected-fg);
}
#changelist-filter #changelist-filter-clear a {
font-size: 0.8125rem;
padding-bottom: 10px;
border-bottom: 1px solid var(--hairline-color);
}
/* DATE DRILLDOWN */
.change-list ul.toplinks {
display: block;
float: left;
padding: 0;
margin: 0;
width: 100%;
}
.change-list ul.toplinks li {
padding: 3px 6px;
font-weight: bold;
list-style-type: none;
display: inline-block;
}
/* ACTIONS */
.filtered .actions {
border-right: none;
}
#changelist .actions {
padding: 10px;
background: var(--body-bg);
border-top: none;
border-bottom: none;
line-height: 24px;
color: var(--body-quiet-color);
width: 100%;
}
#changelist .actions:last-child {
border-bottom: none;
}
border-color: var(--body-quiet-color);
}
--body-fg: #eeeeee;
--body-bg: #121212;
--body-quiet-color: #e0e0e0;
--body-loud-color: #ffffff;
--breadcrumbs-link-fg: #e0e0e0;
--breadcrumbs-bg: var(--primary);
--link-fg: #81d4fa;
--link-hover-color: #4ac1f7;
--link-selected-fg: #6f94c6;
--hairline-color: #272727;
--border-color: #353535;
--error-fg: #e35f5f;
--message-success-bg: #006b1b;
--message-warning-bg: #583305;
--message-error-bg: #570808;
--darkened-bg: #212121;
--selected-bg: #1b1b1b;
--selected-row: #00363a;
--close-button-bg: #333333;
--close-button-hover-bg: #666666;
}
}
/* DASHBOARD */
.module ul.actionlist {
margin-left: 0;
}
ul.actionlist li {
list-style-type: none;
overflow: hidden;
text-overflow: ellipsis;
}
@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Bold-webfont.woff');
font-weight: 700;
font-style: normal;
}
@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Regular-webfont.woff');
font-weight: 400;
font-style: normal;
}
@font-face {
font-family: 'Roboto';
src: url('../fonts/Roboto-Light-webfont.woff');
font-weight: 300;
font-style: normal;
}
@import url('widgets.css');
/* FORM ROWS */
.form-row {
overflow: hidden;
padding: 10px;
font-size: 0.8125rem;
border-bottom: 1px solid var(--hairline-color);
}
form .form-row p {
padding-left: 0;
}
/* FORM LABELS */
label {
font-weight: normal;
color: var(--body-quiet-color);
font-size: 0.8125rem;
}
/* RADIO BUTTONS */
form ul.inline {
margin-left: 0;
padding: 0;
}
form ul.inline li {
float: left;
padding-right: 7px;
}
/* ALIGNED FIELDSETS */
.aligned label {
display: block;
padding: 4px 10px 0 0;
float: left;
width: 160px;
word-wrap: break-word;
line-height: 1;
}
.aligned label:not(.vCheckboxLabel):after {
content: '';
display: inline-block;
vertical-align: middle;
height: 26px;
}
.aligned ul label {
display: inline;
float: none;
width: auto;
}
form .aligned ul {
margin-left: 160px;
padding-left: 10px;
}
form .aligned ul li {
list-style: none;
}
.aligned .vCheckboxLabel {
float: none;
width: auto;
display: inline-block;
vertical-align: -3px;
padding: 0 0 5px 5px;
}
.checkbox-row p.help,
.checkbox-row div.help {
margin-left: 0;
padding-left: 0;
}
fieldset .fieldBox {
float: left;
margin-right: 20px;
}
/* WIDE FIELDSETS */
.wide label {
width: 200px;
}
form .wide p,
form div.help ul {
padding-left: 0;
margin-left: 0;
}
/* COLLAPSED FIELDSETS */
fieldset.collapsed * {
display: none;
}
fieldset.collapsed {
border: 1px solid var(--hairline-color);
border-radius: 4px;
overflow: hidden;
}
fieldset.collapsed h2 {
background: var(--darkened-bg);
color: var(--body-quiet-color);
}
fieldset .collapse-toggle {
color: var(--header-link-color);
}
fieldset.collapsed .collapse-toggle {
background: transparent;
display: inline;
color: var(--link-fg);
}
/* MONOSPACE TEXTAREAS */
fieldset.monospace textarea {
font-family: "Bitstream Vera Sans Mono", Monaco, "Courier New", Courier, monospace;
}
/* SUBMIT ROW */
.submit-row {
padding: 12px 14px 7px;
margin: 0 0 20px;
background: var(--darkened-bg);
border: 1px solid var(--hairline-color);
border-radius: 4px;
text-align: right;
overflow: hidden;
}
body.popup .submit-row {
overflow: auto;
}
.submit-row input {
height: 35px;
line-height: 15px;
margin: 0 0 5px 5px;
}
.submit-row input.default {
margin: 0 0 5px 8px;
text-transform: uppercase;
}
.submit-row p {
margin: 0.3em;
}
.submit-row p.deletelink-box {
float: left;
margin: 0;
}
.submit-row a.deletelink {
display: block;
background: var(--delete-button-bg);
border-radius: 4px;
padding: 10px 15px;
height: 15px;
line-height: 15px;
margin-bottom: 5px;
color: var(--button-fg);
}
.submit-row a.closelink {
display: inline-block;
background: var(--close-button-bg);
border-radius: 4px;
padding: 10px 15px;
height: 15px;
line-height: 15px;
margin: 0 0 0 5px;
color: var(--button-fg);
}
submit-row a.deletelink:focus,
.submit-row a.deletelink:hover,
.submit-row a.deletelink:active {
background: var(--delete-button-hover-bg);
}
.submit-row a.closelink:focus,
.submit-row a.closelink:hover,
.submit-row a.closelink:active {
background: var(--close-button-hover-bg);
}
.vSelectMultipleField {
vertical-align: top;
}
.vCheckboxField {
border: none;
}
.vDateField, .vTimeField {
margin-right: 2px;
margin-bottom: 4px;
}
.vDateField {
min-width: 6.85em;
}
.vTimeField {
min-width: 4.7em;
}
.vURLField {
width: 30em;
}
.vLargeTextField, .vXMLLargeTextField {
width: 48em;
}
.flatpages-flatpage #id_content {
height: 40.2em;
}
.vIntegerField {
width: 5em;
}
.vBigIntegerField {
width: 10em;
}
.vForeignKeyRawIdAdminField {
width: 5em;
}
.vTextField, .vUUIDField {
width: 20em;
}
/* INLINES */
.inline-group {
padding: 0;
margin: 0 0 30px;
}
.inline-group thead th {
padding: 8px 10px;
}
.inline-related {
position: relative;
}
.inline-related h3 {
margin: 0;
color: var(--body-quiet-color);
padding: 5px;
font-size: 0.8125rem;
background: var(--darkened-bg);
border-top: 1px solid var(--hairline-color);
border-bottom: 1px solid var(--hairline-color);
}
.inline-related h3 span.delete {
float: right;
}
.inline-related fieldset {
margin: 0;
background: var(--body-bg);
border: none;
width: 100%;
}
.inline-related fieldset.module h3 {
margin: 0;
padding: 2px 5px 3px 5px;
font-size: 0.6875rem;
text-align: left;
font-weight: bold;
background: #bcd;
color: var(--body-bg);
}
.last-related fieldset {
border: none;
}
.inline-group ul.tools {
padding: 0;
margin: 0;
list-style: none;
}
.inline-group ul.tools li {
display: inline;
padding: 0 5px;
}
.inline-group div.add-row,
.inline-group .tabular tr.add-row td {
color: var(--body-quiet-color);
background: var(--darkened-bg);
padding: 8px 10px;
border-bottom: 1px solid var(--hairline-color);
}
.empty-form {
display: none;
}
.related-lookup {
margin-left: 5px;
display: inline-block;
vertical-align: middle;
background-repeat: no-repeat;
background-size: 14px;
}
.related-lookup {
width: 16px;
height: 16px;
background-image: url(../img/search.svg);
}
form .related-widget-wrapper ul {
display: inline-block;
margin-left: 0;
padding-left: 0;
}
.clearable-file-input input {
margin-top: 0;
}
.selector {
width: 800px;
float: left;
display: flex;
}
.selector select {
width: 380px;
height: 17.2em;
flex: 1 0 auto;
}
.selector-available, .selector-chosen {
width: 380px;
text-align: center;
margin-bottom: 5px;
display: flex;
flex-direction: column;
}
.selector-chosen select {
border-top: none;
}
.selector-chosen h2 {
background: var(--primary);
color: var(--header-link-color);
}
.selector .selector-available h2 {
background: var(--darkened-bg);
color: var(--body-quiet-color);
}
.selector .selector-filter {
border: 1px solid var(--border-color);
border-width: 0 1px;
padding: 8px;
color: var(--body-quiet-color);
font-size: 0.625rem;
margin: 0;
text-align: left;
}
.selector ul.selector-chooser {
align-self: center;
width: 22px;
background-color: var(--selected-bg);
border-radius: 10px;
margin: 0 5px;
padding: 0;
transform: translateY(-17px);
}
.selector-chooser li {
margin: 0;
padding: 3px;
list-style-type: none;
}
.selector select {
padding: 0 10px;
margin: 0 0 10px;
border-radius: 0 0 4px 4px;
}
.selector-add, .selector-remove {
width: 16px;
height: 16px;
display: block;
text-indent: -3000px;
overflow: hidden;
cursor: default;
opacity: 0.55;
}
.active.selector-add, .active.selector-remove {
opacity: 1;
}
.active.selector-add:hover, .active.selector-remove:hover {
cursor: pointer;
}
.selector-add {
background: url(../img/selector-icons.svg) 0 -96px no-repeat;
}
.active.selector-add:focus, .active.selector-add:hover {
background-position: 0 -112px;
}
.selector-remove {
background: url(../img/selector-icons.svg) 0 -64px no-repeat;
}
.active.selector-remove:focus, .active.selector-remove:hover {
background-position: 0 -80px;
}
a.selector-chooseall, a.selector-clearall {
display: inline-block;
height: 16px;
text-align: left;
margin: 1px auto 3px;
overflow: hidden;
font-weight: bold;
line-height: 16px;
color: var(--body-quiet-color);
text-decoration: none;
opacity: 0.55;
}
a.active.selector-chooseall:focus, a.active.selector-clearall:focus,
a.active.selector-chooseall:hover, a.active.selector-clearall:hover {
color: var(--link-fg);
}
a.active.selector-chooseall, a.active.selector-clearall {
opacity: 1;
}
a.active.selector-chooseall:hover, a.active.selector-clearall:hover {
cursor: pointer;
}
a.selector-chooseall {
padding: 0 18px 0 0;
background: url(../img/selector-icons.svg) right -160px no-repeat;
cursor: default;
}
a.active.selector-chooseall:focus, a.active.selector-chooseall:hover {
background-position: 100% -176px;
}
a.selector-clearall {
padding: 0 0 0 18px;
background: url(../img/selector-icons.svg) 0 -128px no-repeat;
cursor: default;
}
a.active.selector-clearall:focus, a.active.selector-clearall:hover {
background-position: 0 -144px;
}
/* STACKED SELECTORS */
.stacked {
float: left;
width: 490px;
display: block;
}
.stacked select {
width: 480px;
height: 10.1em;
}
.stacked .selector-available {
margin-bottom: 0;
}
.stacked ul.selector-chooser {
height: 22px;
width: 50px;
margin: 0 0 10px 40%;
background-color: #eee;
border-radius: 10px;
transform: none;
}
.stacked .selector-chooser li {
float: left;
padding: 3px 3px 3px 5px;
}
.stacked .selector-add {
background: url(../img/selector-icons.svg) 0 -32px no-repeat;
cursor: default;
}
.stacked .active.selector-add {
background-position: 0 -32px;
cursor: pointer;
}
.stacked .selector-remove {
background: url(../img/selector-icons.svg) 0 0 no-repeat;
cursor: default;
}
.stacked .active.selector-remove {
background-position: 0 0px;
cursor: pointer;
}
.selector .help-icon {
background: url(../img/icon-unknown.svg) 0 0 no-repeat;
display: inline-block;
vertical-align: middle;
margin: -2px 0 0 2px;
width: 13px;
height: 13px;
}
.selector .search-label-icon {
background: url(../img/search.svg) 0 0 no-repeat;
display: inline-block;
height: 18px;
width: 18px;
}
p.datetime {
line-height: 20px;
margin: 0;
padding: 0;
color: var(--body-quiet-color);
font-weight: bold;
}
.datetime span {
white-space: nowrap;
font-weight: normal;
font-size: 0.6875rem;
color: var(--body-quiet-color);
}
table p.datetime {
font-size: 0.6875rem;
margin-left: 0;
padding-left: 0;
}
.datetimeshortcuts .clock-icon {
background: url(../img/icon-clock.svg) 0 0 no-repeat;
}
.datetimeshortcuts .date-icon {
background: url(../img/icon-calendar.svg) 0 0 no-repeat;
top: -1px;
}
.timezonewarning {
font-size: 0.6875rem;
color: var(--body-quiet-color);
}
/* URL */
p.url {
line-height: 20px;
margin: 0;
padding: 0;
color: var(--body-quiet-color);
font-size: 0.6875rem;
font-weight: bold;
}
.url a {
font-weight: normal;
}
/* FILE UPLOADS */
p.file-upload {
line-height: 20px;
margin: 0;
padding: 0;
color: var(--body-quiet-color);
font-size: 0.6875rem;
font-weight: bold;
}
.aligned p.file-upload {
margin-left: 170px;
}
.file-upload a {
font-weight: normal;
}
.file-upload .deletelink {
margin-left: 5px;
}
span.clearable-file-input label {
color: var(--body-fg);
font-size: 0.6875rem;
display: inline;
float: none;
}
.calendarbox, .clockbox {
margin: 5px auto;
font-size: 0.75rem;
width: 19em;
text-align: center;
background: var(--body-bg);
color: var(--body-fg);
border: 1px solid var(--hairline-color);
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
overflow: hidden;
position: relative;
}
.clockbox {
width: auto;
}
.calendar {
margin: 0;
padding: 0;
}
.calendar table {
margin: 0;
padding: 0;
border-collapse: collapse;
background: white;
width: 100%;
}
.calendar th {
padding: 8px 5px;
background: var(--darkened-bg);
border-bottom: 1px solid var(--border-color);
font-weight: 400;
font-size: 0.75rem;
text-align: center;
color: var(--body-quiet-color);
}
.calendar td {
font-weight: 400;
font-size: 0.75rem;
text-align: center;
padding: 0;
border-top: 1px solid var(--hairline-color);
border-bottom: none;
}
.calendar td.selected a {
background: var(--primary);
color: var(--button-fg);
}
.calendar td.nonday {
background: var(--darkened-bg);
}
.calendar td.today a {
font-weight: 700;
}
.calendar td a, .timelist a {
display: block;
font-weight: 400;
padding: 6px;
text-decoration: none;
color: var(--body-quiet-color);
}
.calendarnav {
font-size: 0.625rem;
text-align: center;
color: #ccc;
margin: 0;
padding: 1px 3px;
}
.calendar-shortcuts {
background: var(--body-bg);
color: var(--body-quiet-color);
font-size: 0.6875rem;
line-height: 11px;
border-top: 1px solid var(--hairline-color);
padding: 8px 0;
}
display: block;
position: absolute;
top: 8px;
width: 15px;
height: 15px;
text-indent: -9999px;
padding: 0;
}
.calendarnav-previous {
left: 10px;
background: url(../img/calendar-icons.svg) 0 0 no-repeat;
}
.calendarbox .calendarnav-previous:focus,
.calendarbox .calendarnav-previous:hover {
background-position: 0 -15px;
}
.calendarnav-next {
right: 10px;
background: url(../img/calendar-icons.svg) 0 -30px no-repeat;
}
.calendarbox .calendarnav-next:focus,
.calendarbox .calendarnav-next:hover {
background-position: 0 -45px;
}
.calendar-cancel {
margin: 0;
padding: 4px 0;
font-size: 0.75rem;
background: #eee;
border-top: 1px solid var(--border-color);
color: var(--body-fg);
}
.calendar-cancel:focus, .calendar-cancel:hover {
background: #ddd;
}
.calendar-cancel a {
color: black;
display: block;
}
ul.timelist, .timelist li {
list-style-type: none;
margin: 0;
padding: 0;
}
.timelist a {
padding: 2px;
}
/* EDIT INLINE */
.inline-deletelink {
float: right;
text-indent: -9999px;
background: url(../img/inline-delete.svg) 0 0 no-repeat;
width: 16px;
height: 16px;
border: 0px none;
}
.inline-deletelink:focus, .inline-deletelink:hover {
cursor: pointer;
}
.related-widget-wrapper-link {
opacity: 0.3;
}
.related-widget-wrapper-link:link {
opacity: .8;
}
.related-widget-wrapper-link:link:focus,
.related-widget-wrapper-link:link:hover {
opacity: 1;
}
select + .related-widget-wrapper-link,
.related-widget-wrapper-link + .related-widget-wrapper-link {
margin-left: 7px;
}
SCREENSHOTS
IMPLEMENTATION
The final and important phase in system life cycle is the installation of the new system. The term
installation has different meaning, ranging from the conversion of basic application a complete replacement
of a computer system. The procedure, however are virtually the same. Installation is the process of converting
a new system into an operational one. It involves user training and successful running of the developed
system.
In the installation phase the user and the system manuals are prepared handed over to the user to
operate the developed system. The object of each manual is the same but the target customers may be
different.
The user manual is aimed to those who would be using the system but not interested in technical
information about the insides of the system, or implementation of login within the system.
• Usage description
• Back up procedures
• Security measures
CONCLUSION
The project entitled ' E-commerce website ' is very convenient for computer Companies. This system
is very convenient for customers and users to buy E-commerce website products. It can be observed that the
information can be obtained easily and accurately. The E-commerce website shopping Software is made more
user-friendly to the users so that anyone can run the software. Then this software provides permission to enter
to the system via the login password credentials to the user who uses this system. This project manages all the
details about the computer.
In the Future users can buy their identical products using mobile phones. This organization is very
beneficial for both users and companies. This product has great future scope. E-commerce website project
established using web-based technology and for Windows to future versions of environments. This project
also delivers security by using a security credentials like user id as well as password, so that any illegal users
cannot practice your account. The only Lawful person that will consume proper admittance authority can use
the E-commerce website shopping software.
BIBLIOGRAPHY
Books:
1. "Python Crash Course" by Eric Matthes
2. "Automate the Boring Stuff with Python" by Al Sweigart
3. "Learning Python" by Mark Lutz
4. "Python Programming: An Introduction to Computer Science" by John Zelle
5. "Fluent Python" by Luciano Ramalho
For Python :
1. W3Schools: www.w3schools.com/python
2. Python.org (Official Python Website): www.python.org
3. Real Python: realpython.com
4. Codecademy - Learn Python: www.codecademy.com/learn/learn-python
5. Coursera - Python for Everybody: www.coursera.org/specializations/python
6. Automate the Boring Stuff with Python: automatetheboringstuff.com
7. Python Crash Course: www.pythoncrashcourse.com
8. HackerRank - Python Domain: www.hackerrank.com/domains/tutorials/10-days-of-python
9. GeeksforGeeks - Python Programming Language: www.geeksforgeeks.org/python-programming-
language
10. The Hitchhiker's Guide to Python: docs.python-guide.org