Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

небольшие изменения в адресе

  • Loading branch information...
commit 100aeb9e6c48f53f409c5341fcd6201f994f6e3d 1 parent f750ea2
@vladyslav2 authored
Showing with 7 additions and 11 deletions.
  1. +7 −11 shop/util/address.py
View
18 shop/util/address.py
@@ -18,9 +18,9 @@ def get_shipping_address_from_request(request):
# There is a logged-in user here, but he might not have an address
# defined.
try:
- shipping_address = AddressModel.objects.get(
- user_shipping=request.user)
- except AddressModel.DoesNotExist:
+ shipping_address = AddressModel.objects.filter(
+ user_shipping=request.user)[0]
+ except:
shipping_address = None
else:
# The client is a guest - let's use the session instead.
@@ -40,18 +40,14 @@ def get_billing_address_from_request(request):
"""
billing_address = None
session = getattr(request, 'session', None)
- # print session.get('zip_code')
+
if session != None:
# There is a session
if session.get('first_name'):
billing_address = AddressModel(**{
- 'telephone' : session.get('telephone'),
- 'address' : session.get('address'),
- 'first_name' : session.get('first_name'),
- 'last_name' : session.get('last_name'),
- 'email' : session.get('email'),
- })
- billing_address.country_pk = session.get('country')
+ x : session.get(x) for x in AddressModel.saved_fields(True)
+ })
+ print billing_address.country
else:
try:
billing_address = AddressModel.objects.filter(user_billing=request.user)[0]
Please sign in to comment.
Something went wrong with that request. Please try again.