Skip to content

Commit

Permalink
add homepage and fix data
Browse files Browse the repository at this point in the history
  • Loading branch information
kritserv committed Oct 3, 2023
1 parent edc821a commit d846fc1
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
2 changes: 1 addition & 1 deletion FIRST_SETUP_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Brand(id=6, title="Orange", image="media/model_img/brands/Orange.png").save()
Brand(id=7, title="Ros", image="media/model_img/brands/Ros.png").save()
Brand(id=8, title="Suityou", image="media/model_img/brands/Suityou.png").save()
Brand(id=9, title="Uniqueme", image="media/model_img/brands/Uniqueme.png").save()
Brand(id=10, title="Zeus", image="media/model_img/brands/Zues.png").save()
Brand(id=10, title="Zeus", image="media/model_img/brands/Zeus.png").save()
Cloth(id=1, title="DDICE Hoodie unisex (S) (Black)", brand=Brand.objects.get(title="Ddice"), image="media/model_img/cloths/ddice hoodie black uni.png", color="Black", is_in_stock=True, in_stocks=120, is_on_sale=False, og_price=550, price=550, stars=3.9, is_recommend=True, gender="Unisex", cloth_type="Hoody", size="S").save()
Cloth(id=2, title="DDICE Hoodie unisex (M) (Black)", brand=Brand.objects.get(title="Ddice"), image="media/model_img/cloths/ddice hoodie black uni.png", color="Black", is_in_stock=True, in_stocks=110, is_on_sale=False, og_price=550, price=550, stars=3.9, is_recommend=True, gender="Unisex", cloth_type="Hoody", size="M").save()
Expand Down
2 changes: 1 addition & 1 deletion code/main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def home(request):
if 'cloth_data' not in request.session:
request.session['cloth_data'] = GetAllClothData()

return render(request, "homepage.html")
return render(request, "homepage.html", {'brand_data': Brand.objects.all()})

def product_computer(request, id):
product = Computer.objects.get(id=id)
Expand Down
33 changes: 31 additions & 2 deletions code/templates/homepage.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,37 @@
AOS.init();
</script>
<div class="container-fluid">
<h1>Homepage</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<h1>Homepage</h1>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>

<section style="background-color: #eee; width=80%;">
<div class="container py-6" id="prod-container">
<h2>Search Products from Brands</h2>
<div class="row">
{% for brand in brand_data %}
<div class="col-md-6 col-lg-3 mb-4 mb-lg-6">
<div data-aos="flip-down">
{% if brand.title == 'Orange' %}
<a href="/searched/product/?q= {{ brand.title }}">
{% else %}
<a href="/searched/product/?q={{ brand.title }}">
{% endif %}
<div class="card" id="prod-card">
<img src="/media/{{ brand.image }}" class="card-img-top" alt="{{ brand.title }}">
</div>
</a>
</div>
</div>
{% empty %}
<div class="container-fluid">
<div style="margin-left: 3rem; margin-right: 25vw; margin-top: 1.5rem; margin-bottom: 1.5rem;">
<h2>Looks like database didn't exist..</h2>
<h4>Did you follow the setup guide?</h4>
</div>
</div>
{% endfor %}
</div>
</div>
</section>
</div>
{% endblock %}

0 comments on commit d846fc1

Please sign in to comment.