Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PixieDust-LastMinuteSurpluss
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Erick Gabriel T. Lopez
PixieDust-LastMinuteSurpluss
Commits
7a26904f
Commit
7a26904f
authored
Dec 01, 2022
by
Bryan Carlo Guanlao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added product catalog views
parent
11bfd2fa
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
200 additions
and
110 deletions
+200
-110
base.html
pixie_dust/pixie_dust/templates/base.html
+30
-27
urls.py
pixie_dust/pixie_dust/urls.py
+2
-2
0002_alter_penorganizer_table.py
...dust/products/migrations/0002_alter_penorganizer_table.py
+17
-0
0003_alter_penorganizer_table.py
...dust/products/migrations/0003_alter_penorganizer_table.py
+17
-0
products.html
pixie_dust/products/templates/products/products.html
+0
-54
products_detail.html
pixie_dust/products/templates/products/products_detail.html
+37
-0
products_list.html
pixie_dust/products/templates/products/products_list.html
+50
-0
urls.py
pixie_dust/products/urls.py
+10
-5
views.py
pixie_dust/products/views.py
+20
-11
homepage.html
pixie_dust/users/templates/users/homepage.html
+17
-11
No files found.
pixie_dust/pixie_dust/templates/base.html
View file @
7a26904f
{% load static %}
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'style.css' %}"
/>
<title>
Pixie Dust
</title>
</head>
<body>
<header
class=
"header"
id=
"nav"
>
<div
class=
"container"
>
<h2
class=
"logo"
><a
href=
"/"
>
Pixie Dust
</a></h2>
<ul>
{% block content-header %} {% endblock %}
</ul>
</div>
</header>
<div
class=
"parent"
>
</div>
{% block content %} {% endblock %}
<footer>
<div
class=
"footer-container"
>
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
</div>
</footer>
</body>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
<script
src=
"{% static 'script.js' %}"
></script>
</html>
<head>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'style.css' %}"
/>
<title>
Pixie Dust
</title>
</head>
<body>
<header
class=
"header"
id=
"nav"
>
<div
class=
"container"
>
<h2
class=
"logo"
><a
href=
"/"
>
Pixie Dust
</a></h2>
<ul>
{% block content-header %} {% endblock %}
</ul>
</div>
</header>
<div
class=
"parent"
>
</div>
{% block content %} {% endblock %}
<footer>
<div
class=
"footer-container"
>
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
</div>
</footer>
</body>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
<script
src=
"{% static 'script.js' %}"
></script>
</html>
\ No newline at end of file
pixie_dust/pixie_dust/urls.py
View file @
7a26904f
...
...
@@ -20,7 +20,7 @@ from django.contrib import admin
urlpatterns
=
[
path
(
''
,
include
(
'users.urls_main'
)),
path
(
'admin-pd/'
,
include
(
'users.urls'
)),
path
(
'admin-pd/products'
,
include
(
'products.urls'
)),
path
(
'admin-pd/orders'
,
include
(
'orders.urls'
)),
path
(
'admin-pd/products
/
'
,
include
(
'products.urls'
)),
path
(
'admin-pd/orders
/
'
,
include
(
'orders.urls'
)),
path
(
'admin/'
,
admin
.
site
.
urls
),
]
pixie_dust/products/migrations/0002_alter_penorganizer_table.py
0 → 100644
View file @
7a26904f
# Generated by Django 3.2.12 on 2022-11-27 12:46
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'products'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AlterModelTable
(
name
=
'penorganizer'
,
table
=
'penorganizer'
,
),
]
pixie_dust/products/migrations/0003_alter_penorganizer_table.py
0 → 100644
View file @
7a26904f
# Generated by Django 3.2.12 on 2022-11-27 12:47
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'products'
,
'0002_alter_penorganizer_table'
),
]
operations
=
[
migrations
.
AlterModelTable
(
name
=
'penorganizer'
,
table
=
'pen_organizer'
,
),
]
pixie_dust/products/templates/products/products.html
deleted
100644 → 0
View file @
11bfd2fa
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<title>
Product Catalog
</title>
</head>
<header>
<h1>
This is the products html
</h1>
</header>
<main>
<div
class=
"collection"
id=
"folder"
>
<h2>
Folders
</h2>
{% for folder in folder_list %}
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ folder.item_name }}
</div>
<div
class=
"price"
>
₱{{ folder.price }}
</div>
</div>
<ul>
{% for description in description_list %}
{% if folder.item_id == description.item_id%}
<li>
{{ description.feature_id.feature }}
</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% endfor %}
</div>
</main>
<footer>
<div
class=
"footer-container"
>
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
</div>
</footer>
<body>
</body>
</html>
pixie_dust/products/templates/products/products_detail.html
0 → 100644
View file @
7a26904f
<!DOCTYPE html>
<html
lang=
"en"
>
<header>
<h1>
{{product.item_name}} Specs
</h1>
</header>
<main>
<div>
{% if product.folder.collection == "F" %}
<div>
Lenght: {{product.folder.length}} inches
</div>
<div>
Width: {{product.folder.width}} inches
</div>
<div>
Thickness: {{product.folder.thickness}} inches
</div>
{% elif product.penorganizer.collection == "PO" %}
<div>
Slots: {{product.penorganizer.slots}}
</div>
{% elif product.planner.collection == "P" %}
<div>
Lenght: {{product.planner.length}} inches
</div>
<div>
Width: {{product.planner.width}} inches
</div>
<div>
Thickness: {{product.planner.thickness}} inches
</div>
{% endif %}
<div>
Personalization: Up to {{product.personalization}} letters
</div>
</div><br>
<div
class=
"collection"
id=
"folder"
>
<div>
Features:
</div>
{% for description in description_list %}
{% if product.item_id == description.item_id.item_id %}
<li>
{{ description.feature_id.feature }}
</li>
{% endif %}
</div>
{% endfor %}
<footer>
<div
class=
"footer-container"
>
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
</div>
</footer>
\ No newline at end of file
pixie_dust/products/templates/products/products_list.html
0 → 100644
View file @
7a26904f
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<title>
Product Catalog
</title>
</head>
<header>
<h1>
This is the products html
</h1>
</header>
<main>
<div
class=
"collection"
id=
"folder"
>
<h2>
Folders
</h2>
{% for folder in folder_list %}
<div
class=
"card-content-main"
>
<a
href=
"{% url 'products:products-detail' folder.item_id %}"
>
<div
class=
"item_name"
>
{{ folder.item_name }}
</div>
</a>
<div
class=
"price"
>
₱{{ folder.price }}
</div><br>
{% endfor %}
</div>
<h2>
Pen Organizers
</h2>
{% for pen in pen_organizer_list %}
<div
class=
"card-content-main"
>
<a
href=
"{% url 'products:products-detail' pen.item_id %}"
>
<div
class=
"item_name"
>
{{ pen.item_name }}
</div>
</a>
<div
class=
"price"
>
₱{{ pen.price }}
</div><br>
{% endfor %}
</div>
<h2>
Planners
</h2>
{% for planner in planner_list %}
<div
class=
"card-content-main"
>
<a
href=
"{% url 'products:products-detail' planner.item_id %}"
>
<div
class=
"item_name"
>
{{ planner.item_name }}
</div>
</a>
<div
class=
"price"
>
₱{{ planner.price }}
</div><br>
{% endfor %}
</main>
<footer>
<div
class=
"footer-container"
>
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
</div>
</footer>
</html>
\ No newline at end of file
pixie_dust/products/urls.py
View file @
7a26904f
from
django.urls
import
path
from
.
import
views
from
.views
import
(
ProductsDetailView
,
ProductsListView
,
)
appname
=
"products"
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"index"
),
path
(
'/catalog'
,
views
.
catalog
,
name
=
'products'
),
]
\ No newline at end of file
path
(
'catalog'
,
ProductsListView
.
as_view
(),
name
=
'products-list'
),
path
(
'catalog/<int:pk>/details'
,
ProductsDetailView
.
as_view
(),
name
=
'products-detail'
)
]
app_name
=
'products'
pixie_dust/products/views.py
View file @
7a26904f
...
...
@@ -3,17 +3,26 @@ from .models import Product, Folder, PenOrganizer, Planner, Description
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.shortcuts
import
get_object_or_404
# Create your views here.
def
index
(
request
):
return
render
(
request
,
"products/products.html"
)
def
catalog
(
request
):
product_list
=
Product
.
objects
.
all
()
folder_list
=
Folder
.
objects
.
values
(
'item_name'
,
'price'
,
'item_id'
)
.
distinct
()
pen_organizer_list
=
PenOrganizer
.
objects
.
all
()
planner_list
=
Planner
.
objects
.
all
()
description_list
=
Description
.
objects
.
all
()
return
render
(
request
,
"products/products.html"
,
{
"product_list"
:
product_list
,
"folder_list"
:
folder_list
,
"pen_organizer_list"
:
pen_organizer_list
,
"planner_list"
:
planner_list
,
"description_list"
:
description_list
})
\ No newline at end of file
class
ProductsListView
(
ListView
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
product_list
=
Product
.
objects
.
all
()
folder_list
=
Folder
.
objects
.
values
(
'item_name'
,
'price'
,
'item_id'
)
.
distinct
()
pen_organizer_list
=
PenOrganizer
.
objects
.
all
()
planner_list
=
Planner
.
objects
.
all
()
return
render
(
request
,
'products/products_list.html'
,
{
"product_list"
:
product_list
,
"folder_list"
:
folder_list
,
"pen_organizer_list"
:
pen_organizer_list
,
"planner_list"
:
planner_list
})
class
ProductsDetailView
(
DetailView
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
product
=
get_object_or_404
(
Product
,
pk
=
kwargs
[
'pk'
])
description_list
=
Description
.
objects
.
all
()
return
render
(
request
,
'products/products_detail.html'
,
{
'product'
:
product
,
'description_list'
:
description_list
})
pixie_dust/users/templates/users/homepage.html
View file @
7a26904f
...
...
@@ -18,14 +18,16 @@
<div
class=
"wrapper"
>
{% for folder in folder_list %}
<div
class=
"card"
>
<div
class=
"img_wrapper"
><img
src=
"https://images.unsplash.com/photo-1615485737442-7d6ab9f64db9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt=
"product"
></div>
<div
class=
"img_wrapper"
><img
src=
"https://images.unsplash.com/photo-1615485737442-7d6ab9f64db9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt=
"product"
></div>
<div
class=
"card-content"
>
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ folder.item_name }}
</div>
<div
class=
"price"
>
₱{{ folder.price }}
</div>
<div
class=
"price"
>
₱{{ folder.price }}
</div>
</div>
<ul>
{% for description in description_list %}
{% for description in description_list %}
{% if folder.item_id == description.item_id%}
<li>
{{ description.feature_id.feature }}
</li>
{% endif %}
...
...
@@ -33,7 +35,7 @@
</ul>
</div>
</div>
{% endfor %}
{% endfor %}
</div>
</div>
<div
class=
"collection"
id=
"pen_organizer"
>
...
...
@@ -41,14 +43,16 @@
<div
class=
"wrapper"
>
{% for pen_organizer in pen_organizer_list %}
<div
class=
"card"
>
<div
class=
"img_wrapper"
><img
src=
"https://images.unsplash.com/photo-1615485737442-7d6ab9f64db9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt=
"product"
></div>
<div
class=
"img_wrapper"
><img
src=
"https://images.unsplash.com/photo-1615485737442-7d6ab9f64db9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt=
"product"
></div>
<div
class=
"card-content"
>
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ pen_organizer.item_name }}
</div>
<div
class=
"price"
>
₱{{ pen_organizer.price }}
</div>
<div
class=
"price"
>
₱{{ pen_organizer.price }}
</div>
</div>
<ul>
{% for description in description_list %}
{% for description in description_list %}
{% if pen_organizer.item_id == description.item_id.item_id%}
<li>
{{ description.feature_id.feature }}
</li>
{% endif %}
...
...
@@ -64,14 +68,16 @@
<div
class=
"wrapper"
>
{% for planner in planner_list %}
<div
class=
"card"
>
<div
class=
"img_wrapper"
><img
src=
"https://images.unsplash.com/photo-1615485737442-7d6ab9f64db9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt=
"product"
></div>
<div
class=
"img_wrapper"
><img
src=
"https://images.unsplash.com/photo-1615485737442-7d6ab9f64db9?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80"
alt=
"product"
></div>
<div
class=
"card-content"
>
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ planner.item_name }}
</div>
<div
class=
"price"
>
₱{{ planner.price }}
</div>
<div
class=
"price"
>
₱{{ planner.price }}
</div>
</div>
<ul>
{% for description in description_list %}
{% for description in description_list %}
{% if planner.item_id == description.item_id.item_id%}
<li>
{{ description.feature_id.feature }}
</li>
{% endif %}
...
...
@@ -84,4 +90,4 @@
</div>
</section>
<br><br><br><br>
{% endblock %}
{% endblock %}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment