Commit abc8cf0b authored by Erick Lopez's avatar Erick Lopez

Modified Product Views

parent 5b8e999d
<h1>This is the products html</h1> <!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>
from django.urls import path from django.urls import path
from . import views from . import views
appname = "products" appname = "products"
urlpatterns = [ urlpatterns = [
path('', views.index, name="index"), path('', views.index, name="index"),
path('/catalog', views.catalog, name='products'),
] ]
\ No newline at end of file
from django.shortcuts import render from django.shortcuts import render
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
# Create your views here. # Create your views here.
def index(request): def index(request):
return render(request, "products/products.html") 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
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</div> </div>
<ul> <ul>
{% for description in description_list %} {% for description in description_list %}
{% if folder.item_id == description.item_id.item_id%} {% if folder.item_id == description.item_id%}
<li>{{ description.feature_id.feature }}</li> <li>{{ description.feature_id.feature }}</li>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
......
...@@ -6,7 +6,7 @@ def index(request): ...@@ -6,7 +6,7 @@ def index(request):
def homepage(request): def homepage(request):
product_list = Product.objects.all() product_list = Product.objects.all()
folder_list = Folder.objects.all() folder_list = Folder.objects.all().values('item_name', 'price').distinct()
pen_organizer_list = PenOrganizer.objects.all() pen_organizer_list = PenOrganizer.objects.all()
planner_list = Planner.objects.all() planner_list = Planner.objects.all()
description_list = Description.objects.all() description_list = Description.objects.all()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment