Fix bug #2517 (Replace function-based generic views)

Part of the work was done by dropping external code from Pootle codebase, so this is a huge win. This allows us to drop support for Django 1.4.x and jump to Django 1.5.x and 1.6.x.

I am surprised that it took quite a few work.