fix: docker build
This commit is contained in:
+16
-7
@@ -10,7 +10,10 @@ from django.views.generic import TemplateView
|
||||
|
||||
from config.mixins import HTMXFormComponent
|
||||
from shop.filters import ProductFilter
|
||||
from shop.models import CartItem, CustomerAddress, Product, ProductPrice, ShippingMethod, WishlistedProduct
|
||||
from shop.models import (
|
||||
CartItem, CustomerAddress, Product, ProductPrice,
|
||||
ShippingMethod, WishlistedProduct,
|
||||
)
|
||||
from users.forms.change_password import ChangePasswordForm
|
||||
from users.forms.info import UserInfoForm
|
||||
from web.forms import CustomerAddressForm
|
||||
@@ -140,7 +143,11 @@ class UserInfoFormComponentView(HTMXFormComponent):
|
||||
return reverse('web:user_info_component')
|
||||
|
||||
def get_initial_values(self, instance):
|
||||
return {'email': instance.email, 'first_name': instance.first_name, 'last_name': instance.last_name}
|
||||
return {
|
||||
'email': instance.email,
|
||||
'first_name': instance.first_name,
|
||||
'last_name': instance.last_name
|
||||
}
|
||||
|
||||
|
||||
class ChangePasswordFormComponentView(HTMXFormComponent):
|
||||
@@ -165,18 +172,20 @@ class ListCustomerAddressComponent(TemplateView):
|
||||
template_name = 'components/users/retrieve_update_address.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
return {'customer_addresses': CustomerAddress.objects.filter(user=self.request.user)}
|
||||
return {
|
||||
'customer_addresses': CustomerAddress.objects.filter(user=self.request.user)
|
||||
}
|
||||
|
||||
|
||||
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, headers={'HX-Trigger': 'updated_addresses'})
|
||||
if not form.is_valid():
|
||||
return HttpResponse(form.errors, status=400)
|
||||
|
||||
return HttpResponse(form.errors, status=400)
|
||||
form.save()
|
||||
return HttpResponse(status=200, headers={'HX-Trigger': 'updated_addresses'})
|
||||
|
||||
|
||||
list_products = ListProducts.as_view()
|
||||
|
||||
Reference in New Issue
Block a user