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
Show 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 %}
{% load static %}
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"UTF-8"
/>
<meta
charset=
"UTF-8"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'style.css' %}"
/>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static 'style.css' %}"
/>
<title>
Pixie Dust
</title>
<title>
Pixie Dust
</title>
</head>
</head>
<body>
<body>
<header
class=
"header"
id=
"nav"
>
<header
class=
"header"
id=
"nav"
>
<div
class=
"container"
>
<div
class=
"container"
>
<h2
class=
"logo"
><a
href=
"/"
>
Pixie Dust
</a></h2>
<h2
class=
"logo"
><a
href=
"/"
>
Pixie Dust
</a></h2>
...
@@ -24,7 +26,8 @@
...
@@ -24,7 +26,8 @@
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
<a
href=
"/admin-pd"
>
©Last Minute Surplus
</a>
</div>
</div>
</footer>
</footer>
</body>
</body>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
<script
src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"
></script>
<script
src=
"{% static 'script.js' %}"
></script>
<script
src=
"{% static 'script.js' %}"
></script>
</html>
</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
...
@@ -20,7 +20,7 @@ from django.contrib import admin
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
include
(
'users.urls_main'
)),
path
(
''
,
include
(
'users.urls_main'
)),
path
(
'admin-pd/'
,
include
(
'users.urls'
)),
path
(
'admin-pd/'
,
include
(
'users.urls'
)),
path
(
'admin-pd/products'
,
include
(
'products.urls'
)),
path
(
'admin-pd/products
/
'
,
include
(
'products.urls'
)),
path
(
'admin-pd/orders'
,
include
(
'orders.urls'
)),
path
(
'admin-pd/orders
/
'
,
include
(
'orders.urls'
)),
path
(
'admin/'
,
admin
.
site
.
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
django.urls
import
path
from
.
import
views
from
.views
import
(
ProductsDetailView
,
ProductsListView
,
)
appname
=
"products"
appname
=
"products"
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
views
.
index
,
name
=
"index"
),
path
(
'catalog'
,
ProductsListView
.
as_view
(),
name
=
'products-list'
),
path
(
'/catalog'
,
views
.
catalog
,
name
=
'products'
),
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
...
@@ -3,17 +3,26 @@ from .models import Product, Folder, PenOrganizer, Planner, Description
from
django.views.generic.list
import
ListView
from
django.views.generic.list
import
ListView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.detail
import
DetailView
from
django.views.generic.edit
import
CreateView
from
django.views.generic.edit
import
CreateView
from
django.shortcuts
import
get_object_or_404
# Create your views here.
# Create your views here.
def
index
(
request
):
return
render
(
request
,
"products/products.html"
)
def
catalog
(
request
):
class
ProductsListView
(
ListView
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
product_list
=
Product
.
objects
.
all
()
product_list
=
Product
.
objects
.
all
()
folder_list
=
Folder
.
objects
.
values
(
'item_name'
,
'price'
,
'item_id'
)
.
distinct
()
folder_list
=
Folder
.
objects
.
values
(
'item_name'
,
'price'
,
'item_id'
)
.
distinct
()
pen_organizer_list
=
PenOrganizer
.
objects
.
all
()
pen_organizer_list
=
PenOrganizer
.
objects
.
all
()
planner_list
=
Planner
.
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
()
description_list
=
Description
.
objects
.
all
()
return
render
(
request
,
"products/products.html"
,
{
"product_list"
:
product_list
,
"folder_list"
:
folder_list
,
return
render
(
request
,
'products/products_detail.html'
,
"pen_organizer_list"
:
pen_organizer_list
,
"planner_list"
:
planner_list
,
{
'product'
:
product
,
'description_list'
:
description_list
})
"description_list"
:
description_list
})
\ No newline at end of file
pixie_dust/users/templates/users/homepage.html
View file @
7a26904f
...
@@ -18,7 +18,9 @@
...
@@ -18,7 +18,9 @@
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
{% for folder in folder_list %}
{% for folder in folder_list %}
<div
class=
"card"
>
<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"
>
<div
class=
"card-content-main"
>
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ folder.item_name }}
</div>
<div
class=
"item_name"
>
{{ folder.item_name }}
</div>
...
@@ -41,7 +43,9 @@
...
@@ -41,7 +43,9 @@
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
{% for pen_organizer in pen_organizer_list %}
{% for pen_organizer in pen_organizer_list %}
<div
class=
"card"
>
<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"
>
<div
class=
"card-content-main"
>
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ pen_organizer.item_name }}
</div>
<div
class=
"item_name"
>
{{ pen_organizer.item_name }}
</div>
...
@@ -64,7 +68,9 @@
...
@@ -64,7 +68,9 @@
<div
class=
"wrapper"
>
<div
class=
"wrapper"
>
{% for planner in planner_list %}
{% for planner in planner_list %}
<div
class=
"card"
>
<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"
>
<div
class=
"card-content-main"
>
<div
class=
"card-content-main"
>
<div
class=
"item_name"
>
{{ planner.item_name }}
</div>
<div
class=
"item_name"
>
{{ planner.item_name }}
</div>
...
...
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