feat: added customer addresses and shipping method
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
from decimal import Decimal
|
||||
|
||||
from django.db.models import Sum
|
||||
from django.shortcuts import render
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
@@ -8,12 +7,12 @@ from shop.filters import ProductFilter
|
||||
from shop.models import CartItem, Product, ProductPrice
|
||||
from web.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
||||
from web.settings import ANONYMOUS_CART_ID_COOKIE_NAME
|
||||
from web.utils import get_cart_total, get_or_create_cart
|
||||
from web.utils import get_or_create_cart
|
||||
|
||||
|
||||
class ListProducts(TemplateView, FilteredQuerysetMixin, PaginatedQuerysetMixin):
|
||||
template_name = "web/list_products.html"
|
||||
queryset = Product.objects.all().prefetch_related(
|
||||
queryset = Product.objects.filter(hidden=False).prefetch_related(
|
||||
"images",
|
||||
)
|
||||
filter_class = ProductFilter
|
||||
|
||||
@@ -4,6 +4,7 @@ from django.shortcuts import redirect, render, reverse
|
||||
from django.utils.text import gettext_lazy as _
|
||||
from django.views.generic import TemplateView, View
|
||||
|
||||
from shop.models import CustomerAddress
|
||||
from users.forms import LoginForm
|
||||
from web.models import WebSettings
|
||||
|
||||
@@ -77,6 +78,12 @@ class ResetPasswordView(TemplateView):
|
||||
class MyAccountView(TemplateView):
|
||||
template_name = "users/user_details.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
addresses = CustomerAddress.objects.filter(user=self.request.user)
|
||||
return {
|
||||
"customer_addresses": addresses,
|
||||
}
|
||||
|
||||
|
||||
login = LoginView.as_view()
|
||||
logout = LogoutView.as_view()
|
||||
|
||||
Reference in New Issue
Block a user