fix: moved svg files
This commit is contained in:
+26
-2
@@ -1,9 +1,11 @@
|
||||
from django.http.response import HttpResponse
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django.utils.text import gettext_lazy as _
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.views.generic import TemplateView, View
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from shop.models import CartItem, Product
|
||||
from web.models import WebSettings
|
||||
from web.settings import ANONYMOUS_CART_ID_COOKIE_NAME
|
||||
from web.utils import get_or_create_cart
|
||||
|
||||
@@ -12,8 +14,11 @@ class IndexView(TemplateView):
|
||||
template_name = "web/index.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
settings = WebSettings.load()
|
||||
return {
|
||||
"title": "Shoppy",
|
||||
"title": settings.web_title,
|
||||
"web_title": settings.web_title,
|
||||
"description": settings.web_description,
|
||||
}
|
||||
|
||||
|
||||
@@ -21,16 +26,34 @@ class ProductDetail(TemplateView):
|
||||
template_name = "web/product_detail.html"
|
||||
|
||||
def get_context_data(self, pk, slug, **kwargs):
|
||||
settings = WebSettings.load()
|
||||
product = get_object_or_404(Product, pk=pk)
|
||||
|
||||
return {
|
||||
"product": product,
|
||||
"title": product.name,
|
||||
"web_title": settings.web_title,
|
||||
"description": product.description,
|
||||
"image": product.images.first(),
|
||||
}
|
||||
|
||||
|
||||
class CartDetail(TemplateView):
|
||||
template_name = "web/cart_detail.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
web_settings = WebSettings.load()
|
||||
cart, created = get_or_create_cart(self.request)
|
||||
cart_items = CartItem.objects.filter(cart=cart).prefetch_related("product")
|
||||
|
||||
return {
|
||||
"cart": cart,
|
||||
"items": cart_items,
|
||||
"title": web_settings.web_title,
|
||||
"description": _("resumen del carrito"),
|
||||
}
|
||||
|
||||
|
||||
@require_http_methods(
|
||||
[
|
||||
"POST",
|
||||
@@ -76,3 +99,4 @@ def delete_cart_item(request, pk, *args, **kwargs):
|
||||
|
||||
index = IndexView.as_view()
|
||||
product_detail = ProductDetail.as_view()
|
||||
cart_detail = CartDetail.as_view()
|
||||
|
||||
Reference in New Issue
Block a user