feat: update address working
This commit is contained in:
@@ -14,6 +14,7 @@ from shop.models import (
|
||||
WishlistedProduct,
|
||||
)
|
||||
from users.forms.info import UserInfoForm
|
||||
from web.forms import CustomerAddressForm
|
||||
from web.mixins import FilteredQuerysetMixin, PaginatedQuerysetMixin
|
||||
from web.models import WebSettings
|
||||
from web.settings import ANONYMOUS_CART_ID_COOKIE_NAME
|
||||
@@ -178,6 +179,17 @@ class UserInfoComponentView(TemplateView):
|
||||
return render(request, self.template_name, {"form": form})
|
||||
|
||||
|
||||
def update_customer_address(request, pk):
|
||||
customer_address = get_object_or_404(CustomerAddress, pk=pk, user=request.user)
|
||||
form = CustomerAddressForm(request.POST, instance=customer_address)
|
||||
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
return HttpResponse(status=200)
|
||||
|
||||
return HttpResponse(form.errors, status=400)
|
||||
|
||||
|
||||
list_products = ListProducts.as_view()
|
||||
list_wishlisted_products = ListWishlistedProducts.as_view()
|
||||
wishlist_button = WishlistButton.as_view()
|
||||
|
||||
Reference in New Issue
Block a user