mbertheau/django-oscar — pull request #2 by bocribbz (2014-02-18 17:58:05+00:00)
Title: Checkout skip shipping if not required

I have decided to avoid the redirects, but returning the desired landing View whenever shipping is not required. This way, in case there is some sort of shift to include items that do require shipping too, that will still work.
I have decided to keep checkout.views.IndexView in the loop as it performs basic authentication checks.

First of all, I wrote tests for existing functionality since I noticed the scenario "checkout with shipping not required" is not covered.

Then, because each View had to check if shipping is required, I have escalated the logic to CheckoutSessionMixin, which is used by each of them.

If the project really contains 100% non-shippable items, then the project templates should overwrite the oscar template to exclude the Checkout nav block.

For the end user, there should be absolutely no redirect from /checkout/, but it will directly return the /checkout/payment-details/ output (which can be customized to any other View by adjusting the NextView argument).