Changes before error encountered
Agent-Logs-Url: https://github.com/dsaub/proyecto-final/sessions/f8687aac-de86-402f-b36d-ea422d24ed8e Co-authored-by: dsaub <54474838+dsaub@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
d55026b69d
commit
a94c256ad5
@@ -196,9 +196,11 @@
|
|||||||
<a href="{% url 'producto' product.id %}" class="btn btn-primary btn-sm flex-grow-1">
|
<a href="{% url 'producto' product.id %}" class="btn btn-primary btn-sm flex-grow-1">
|
||||||
Ver detalles
|
Ver detalles
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url 'add_to_cart' product.id %}" class="btn btn-outline-primary btn-sm">
|
<form method="post" action="{% url 'add_to_cart' product.id %}" style="display:inline;">
|
||||||
🛒
|
{% csrf_token %}
|
||||||
</a>
|
<input type="hidden" name="quantity" value="1">
|
||||||
|
<button type="submit" class="btn btn-outline-primary btn-sm">🛒</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -79,9 +79,11 @@
|
|||||||
<a href="{% url 'producto' product.id %}" class="btn btn-primary btn-sm flex-grow-1">
|
<a href="{% url 'producto' product.id %}" class="btn btn-primary btn-sm flex-grow-1">
|
||||||
Ver detalles
|
Ver detalles
|
||||||
</a>
|
</a>
|
||||||
<a href="{% url 'add_to_cart' product.id %}" class="btn btn-outline-primary btn-sm">
|
<form method="post" action="{% url 'add_to_cart' product.id %}" style="display:inline;">
|
||||||
🛒
|
{% csrf_token %}
|
||||||
</a>
|
<input type="hidden" name="quantity" value="1">
|
||||||
|
<button type="submit" class="btn btn-outline-primary btn-sm">🛒</button>
|
||||||
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ from .vars import (
|
|||||||
)
|
)
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
from django.views.decorators.http import require_POST
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from decimal import Decimal, ROUND_HALF_UP
|
from decimal import Decimal, ROUND_HALF_UP
|
||||||
@@ -704,6 +705,7 @@ def create_order_from_cart(request, payment_method, payment_reference="", shippi
|
|||||||
return order, ""
|
return order, ""
|
||||||
|
|
||||||
|
|
||||||
|
@require_POST
|
||||||
def add_to_cart(request: HttpRequest, product_id: int):
|
def add_to_cart(request: HttpRequest, product_id: int):
|
||||||
"""Agrega un producto al carrito"""
|
"""Agrega un producto al carrito"""
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user