Making custom flow

Very often end users ask us to change the flow of actions on site. In many cases, reordering forms is posible, but requires both changes to templates and logic (where Redirects go, where next page is going to be).

Django developers made half of the complete solution: use {% url ... %} tag to code URLs in template. But the function to call same from your views is not publicly accessible, or does not work in all cases. That is why flow.py with a single function: "view_to_url" has been created.

Usage example:

from DjHDGutils.flow import view_to_url
return HttpResponseRedirect("%s?order=%s"%(view_to_url('djw.custom.Order.views.checkout_successfull'),
                                           iri_to_uri(cart_key)))

We also follow DRY principle here: URLs are defined only in urls.py structure, and nowhere else. For example, in our e-commerce product djWarehouse, cart flow defined as a  settings.CART_FLOW variable, and it seems to be enough for typical e-commerce store needs.