Skip to content

Commit

Permalink
Edit views so any user who adds artwork to shop can edit or delete th…
Browse files Browse the repository at this point in the history
…e product
Rate limit · GitHub

Whoa there!

You have triggered an abuse detection mechanism.

Please wait a few minutes before you try again;
in some cases this may take up to an hour.

alissatroiano committed Aug 30, 2023
1 parent 25d13bc commit 39c698b
Showing 5 changed files with 3 additions and 54 deletions.
3 changes: 1 addition & 2 deletions hugo/templates/hugo.html
Original file line number Diff line number Diff line change
@@ -14,8 +14,7 @@
{% endblock %}
{% block content %}
<div class="overlay"></div>
<div class="container-fluid mt-4 p-2">

<div class="container-fluid mt-4 p-2">
<div class="row mt-3 ps-sm-3 ps-md-4 ps-lg-5 d-lg-none">
<div class="col-8 offset-2 text-start m-3">
<div class="dropdown">
35 changes: 0 additions & 35 deletions shop/templates/shop/includes/shop-nav.html

This file was deleted.

8 changes: 0 additions & 8 deletions shop/templates/shop/shop.html
Original file line number Diff line number Diff line change
@@ -32,7 +32,6 @@ <h2 class="display-font my-3 mt-4 pt-lg-5">The Shop</h2>
</span>
</a>
{% endfor %}

</div>
</div>
<div class="row d-flex g-4 justify-content-center justify-content-lg-between my-0 mx-auto px-3 px-lg-5 pb-3">
@@ -107,13 +106,6 @@ <h6 class="p-price text-main body-sm mb-0 text-left fw-bold ms-2 my-2">
</a>
</p>
{% endif %}
{% if product.style %}
<p class="body-small body-font mt-1 mb-0">
<a class="text-muted" href="{% url 'shop' %}?style={{ product.style.name }}">
<i class="fas fa-tag mr-1"></i>{{ product.style.friendly_name }}
</a>
</p>
{% endif %}
{% if request.user == product.user %}
<div class="row">
<div class="col-12 text-center">
8 changes: 0 additions & 8 deletions shop/views.py
Original file line number Diff line number Diff line change
@@ -184,10 +184,6 @@ def add_product(request):
@login_required
def edit_product(request, product_id):
""" A view so shop manager can edit existing products """
if not request.user.is_superuser:
messages.error(request, 'Sorry, only store owners can do that.')
return redirect(reverse('home'))

product = get_object_or_404(Product, pk=product_id)
if request.method == 'POST':
form = EditProductForm(request.POST, request.FILES, instance=product)
@@ -215,10 +211,6 @@ def edit_product(request, product_id):
@login_required
def delete_product(request, product_id):
""" A view so shop manager can delete existing products """
if not request.user.is_superuser:
messages.error(request, 'Sorry, only store owners can do that.')
return redirect(reverse('home'))

product = get_object_or_404(Product, pk=product_id)
product.delete()
messages.success(request, 'Product deleted!')
3 changes: 2 additions & 1 deletion templates/includes/shop-nav.html
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@
<a href="{% url 'shop' %}?category=digital-art&direction=asc" class="nav-link display-font">Digital Art</a>
</li>
<li class="list-item">
<a href="{% url 'shop' %}?category=pop-art&direction=asc" class="nav-link display-font">Pop Art</a>
<a href="{% url 'shop' %}?category=pop-art&direction=asc"
class="nav-link display-font">Pop Art</a>
</li>
<li class="list-item">
<a href="{% url 'shop' %}?category=fine-art&direction=asc"

0 comments on commit 39c698b

Please sign in to comment.