Distinguish between pre- and skip-conditions for checkout views
Terminology:
- A *pre*-condition is a condition that must be met in order for a view
to be available. If it isn't then the customer will be redirected to
a view *earlier* in the chain.
- A *skip*-condition is a condition that must NOT be met in order for a
view to be available. If the condition is met, this means the view can
be skipped and the customer should be redirected to a view *later* in
the chain.
This change implements the above by introducing skip conditions for
checkout views. They allow the previous payment pre-conditions to be
cleanly separated.
An existing basket pre-condition is also changed to be a skip-condition.
It is now replaced with a checkout pre-condition that applies to every
checkout view. If someone's basket becomes invalid while they are in
checkout, then they will be redirected back to the basket page.
Checkout index view enforces basket must be non-empty
This change introduces a new framework for enforcing checkout
pre-conditions. Each view class can define a class attribute
'pre_conditions' which lists method names to run before the class
itself.
Of course, decorators are more conventional for this kind of thing but
they are harder to override and customise.