Просмотр исходного кода

Use success_url consistently in checkout views.

master
Nando Davis 7 лет назад
Родитель
Сommit
b2b76fb4c7
1 измененных файлов: 7 добавлений и 2 удалений
  1. 7
    2
      src/oscar/apps/checkout/views.py

+ 7
- 2
src/oscar/apps/checkout/views.py Просмотреть файл

@@ -251,6 +251,7 @@ class ShippingMethodView(CheckoutSessionMixin, generic.FormView):
251 251
     pre_conditions = ['check_basket_is_not_empty',
252 252
                       'check_basket_is_valid',
253 253
                       'check_user_email_is_captured']
254
+    success_url = reverse_lazy('checkout:payment-method')
254 255
 
255 256
     def post(self, request, *args, **kwargs):
256 257
         self._methods = self.get_available_shipping_methods()
@@ -327,7 +328,7 @@ class ShippingMethodView(CheckoutSessionMixin, generic.FormView):
327 328
         return super().form_invalid(form)
328 329
 
329 330
     def get_success_response(self):
330
-        return redirect('checkout:payment-method')
331
+        return redirect(self.get_success_url())
331 332
 
332 333
 
333 334
 # ==============
@@ -349,6 +350,7 @@ class PaymentMethodView(CheckoutSessionMixin, generic.TemplateView):
349 350
         'check_user_email_is_captured',
350 351
         'check_shipping_data_is_captured']
351 352
     skip_conditions = ['skip_unless_payment_is_required']
353
+    success_url = reverse_lazy('checkout:payment-details')
352 354
 
353 355
     def get(self, request, *args, **kwargs):
354 356
         # By default we redirect straight onto the payment details view. Shops
@@ -357,7 +359,10 @@ class PaymentMethodView(CheckoutSessionMixin, generic.TemplateView):
357 359
         return self.get_success_response()
358 360
 
359 361
     def get_success_response(self):
360
-        return redirect('checkout:payment-details')
362
+        return redirect(self.get_success_url())
363
+
364
+    def get_success_url(self):
365
+        return str(self.success_url)
361 366
 
362 367
 
363 368
 # ================

Загрузка…
Отмена
Сохранить