Skip to content

Commit

Permalink
Fix checkout pre-population from profile model.
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenmcd committed Jul 23, 2014
1 parent 4b679a6 commit 88543f2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cartridge/shop/checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from django.utils.translation import ugettext as _
from django.template.loader import get_template, TemplateDoesNotExist
from mezzanine.accounts import get_profile_for_user
from mezzanine.accounts import get_profile_for_user, ProfileNotConfigured

from mezzanine.conf import settings
from mezzanine.utils.email import send_mail_template
Expand Down Expand Up @@ -126,9 +126,10 @@ def initial_order_data(request, form_class=None):
# for the field value, to support custom matches on the profile
# model.
user_models = [request.user]
profile = get_profile_for_user(request.user)
if profile:
user_models.insert(0, profile)
try:
user_models.insert(0, get_profile_for_user(request.user))
except ProfileNotConfigured:
pass
for order_field in OrderForm._meta.fields:
check_fields = [order_field]
for prefix in ("billing_detail_", "shipping_detail_"):
Expand Down

0 comments on commit 88543f2

Please sign in to comment.