Commits

NikolayBlohin committed 7f051bf

Fix error.

Comments (0)

Files changed (2)

lfs/checkout/views.py

         country_iso = request.POST.get("invoice-country", None)
 
     if country_iso is not None:
-        country = Country.objects.get(code=country_iso.lower())
+        country = Country.objects.filter(code=country_iso.lower())[0]
         if customer.selected_shipping_address:
             customer.selected_shipping_address.country = country
             customer.selected_shipping_address.save()
 
     lfs.shipping.utils.update_to_valid_shipping_method(request, customer)
     lfs.payment.utils.update_to_valid_payment_method(request, customer)
-    customer.save()
+    customer.save()

lfs/customer/views.py

             customer_selected_address.city = request.POST.get(prefix + "-city", "")
             customer_selected_address.state = request.POST.get(prefix + "-state", "")
             customer_selected_address.zip_code = request.POST.get(prefix + "-code", "")
-            customer_selected_address.country = Country.objects.get(code=country_iso.lower())
+            customer_selected_address.country = Country.objects.filter(code=country_iso.lower())[0]
             customer_selected_address.save()
     if not existing_address:
         # no address exists for customer so create one
                                                             city=request.POST.get(prefix + "-city", ""),
                                                             state=request.POST.get(prefix + "-state", ""),
                                                             zip_code=request.POST.get(prefix + "-code", ""),
-                                                            country=Country.objects.get(code=country_iso.lower()))
+                                                            country=Country.objects.filter(code=country_iso.lower())[0])
     setattr(customer, address_attribute, customer_selected_address)
     customer.save()
     return customer_selected_address