|
|
@@ -5,30 +5,35 @@ from django.core.urlresolvers import reverse
|
|
5
|
5
|
from django.contrib import messages
|
|
6
|
6
|
from django.core.exceptions import ObjectDoesNotExist
|
|
7
|
7
|
from django.contrib.auth import login
|
|
|
8
|
+from django.db.models import get_model
|
|
8
|
9
|
from django.utils.translation import ugettext as _
|
|
9
|
10
|
from django.views.generic import DetailView, TemplateView, FormView, \
|
|
10
|
11
|
DeleteView, UpdateView, CreateView
|
|
11
|
12
|
|
|
12
|
13
|
from oscar.apps.shipping.methods import Free
|
|
13
|
|
-from oscar.core.loading import import_module
|
|
14
|
|
-import_module('checkout.forms', ['ShippingAddressForm', 'GatewayForm'], locals())
|
|
15
|
|
-import_module('checkout.calculators', ['OrderTotalCalculator'], locals())
|
|
16
|
|
-import_module('checkout.utils', ['CheckoutSessionData'], locals())
|
|
17
|
|
-import_module('checkout.signals', ['pre_payment', 'post_payment'], locals())
|
|
18
|
|
-import_module('order.models', ['Order', 'ShippingAddress',
|
|
19
|
|
- 'CommunicationEvent', 'PaymentEventType',
|
|
20
|
|
- 'PaymentEvent'], locals())
|
|
21
|
|
-import_module('order.utils', ['OrderNumberGenerator', 'OrderCreator'], locals())
|
|
22
|
|
-import_module('address.models', ['UserAddress'], locals())
|
|
23
|
|
-import_module('address.forms', ['UserAddressForm'], locals())
|
|
24
|
|
-import_module('shipping.repository', ['Repository'], locals())
|
|
25
|
|
-import_module('customer.models', ['Email', 'CommunicationEventType'], locals())
|
|
26
|
|
-import_module('customer.views', ['AccountAuthView'], locals())
|
|
27
|
|
-import_module('customer.utils', ['Dispatcher'], locals())
|
|
28
|
|
-import_module('payment.exceptions', ['RedirectRequired', 'UnableToTakePayment',
|
|
29
|
|
- 'PaymentError'], locals())
|
|
30
|
|
-import_module('order.exceptions', ['UnableToPlaceOrder'], locals())
|
|
31
|
|
-import_module('basket.models', ['Basket'], locals())
|
|
|
14
|
+from oscar.core.loading import get_class, get_classes
|
|
|
15
|
+ShippingAddressForm, GatewayForm = get_classes('checkout.forms', ['ShippingAddressForm', 'GatewayForm'])
|
|
|
16
|
+OrderTotalCalculator = get_class('checkout.calculators', 'OrderTotalCalculator')
|
|
|
17
|
+CheckoutSessionData = get_class('checkout.utils', 'CheckoutSessionData')
|
|
|
18
|
+pre_payment, post_payment = get_classes('checkout.signals', ['pre_payment', 'post_payment'])
|
|
|
19
|
+OrderNumberGenerator, OrderCreator = get_classes('order.utils', ['OrderNumberGenerator', 'OrderCreator'])
|
|
|
20
|
+UserAddressForm = get_class('address.forms', 'UserAddressForm')
|
|
|
21
|
+Repository = get_class('shipping.repository', 'Repository')
|
|
|
22
|
+AccountAuthView = get_class('customer.views', 'AccountAuthView')
|
|
|
23
|
+Dispatcher = get_class('customer.utils', 'Dispatcher')
|
|
|
24
|
+RedirectRequired, UnableToTakePayment, PaymentError = get_classes(
|
|
|
25
|
+ 'payment.exceptions', ['RedirectRequired', 'UnableToTakePayment', 'PaymentError'])
|
|
|
26
|
+UnableToPlaceOrder = get_class('order.exceptions', 'UnableToPlaceOrder')
|
|
|
27
|
+
|
|
|
28
|
+Order = get_model('order', 'Order')
|
|
|
29
|
+ShippingAddress = get_model('order', 'ShippingAddress')
|
|
|
30
|
+CommunicationEvent = get_model('order', 'CommunicationEvent')
|
|
|
31
|
+PaymentEventType = get_model('order', 'PaymentEventType')
|
|
|
32
|
+PaymentEvent = get_model('order', 'PaymentEvent')
|
|
|
33
|
+UserAddress = get_model('address', 'UserAddress')
|
|
|
34
|
+Basket = get_model('basket', 'Basket')
|
|
|
35
|
+Email = get_model('customer', 'Email')
|
|
|
36
|
+CommunicationEventType = get_model('customer', 'CommunicationEventType')
|
|
32
|
37
|
|
|
33
|
38
|
# Standard logger for checkout events
|
|
34
|
39
|
logger = logging.getLogger('oscar.checkout')
|