fix: moved svg files
This commit is contained in:
@@ -2,7 +2,7 @@ from django.shortcuts import render
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from shop.filters import ProductFilter
|
||||
from shop.models import Cart, Product, ProductPrice
|
||||
from shop.models import Product
|
||||
from web.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
||||
from web.settings import ANONYMOUS_CART_ID_COOKIE_NAME
|
||||
from web.utils import get_or_create_cart
|
||||
|
||||
+13
-1
@@ -1,9 +1,11 @@
|
||||
from django.contrib.auth import login as login_user
|
||||
from django.contrib.auth import logout as logout_user
|
||||
from django.shortcuts import redirect, render, reverse
|
||||
from django.utils.text import gettext_lazy as _
|
||||
from django.views.generic import TemplateView, View
|
||||
|
||||
from users.forms import LoginForm
|
||||
from web.models import WebSettings
|
||||
|
||||
|
||||
class RedirectionMixin:
|
||||
@@ -25,8 +27,18 @@ class LoginView(View, RedirectionMixin):
|
||||
if request.user.is_authenticated:
|
||||
return redirect(self.get_redirection())
|
||||
|
||||
settings = WebSettings.load()
|
||||
login_form = self.login_form_class()
|
||||
return render(request, self.template_name, {"form": login_form})
|
||||
|
||||
return render(
|
||||
request,
|
||||
self.template_name,
|
||||
{
|
||||
"form": login_form,
|
||||
"title": settings.web_title,
|
||||
"description": _("inicio de sesión"),
|
||||
},
|
||||
)
|
||||
|
||||
def post(self, request, *args, **kwargs):
|
||||
login_form = self.get_login_form(request)
|
||||
|
||||
+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