Bug was discovered because we added the creation_date non-null field as
content_hash is the primary key. When saving a Document with the same
content_hash, Django try to update the existing document by setting
creation_date to NULL which fails.
It prevents a client from pushing the same file multiple times, which
makes temporary errors harder to handle (client would have to handle a
failure from the web-service). We allow any number of push of the same
document, orphans will be cleaned up by a background task, and storage
is not duplicated as document are deduplicated through their hash.
* declare all views with .as_view()
* add helper make_url() to properly add parameters to query string of
redirect_uri
* stop threading the redirect_uri through the session
* make POST form target implicit, so that parameters are kept
* do checks in dispatch() to share them between POST and GET methods
- a serializer for referring to an user factorized with the push document API
- add common mixin for handling validation errors and successfull results
- add common fixtures for writing tests