KristianOellegaard/django-hvad — pull request #225 by spectras (2014-12-28 10:41:31+00:00)
Title: Refactor and cleanup hvad.views.

We have some legacy code for views, that is seldom used, has but 2 tests, and is not documented at all. I believe not many projects would be using it, which should ease transition.

This PR refactors the whole `views` thing, to make it conform to Django semantics for generic views. The most visible changes are:
- `_language` is renamed to `get_language`.
- `_get_object` is renamed to `get_object`.
- default field for object id is now `pk` instead of `object_id`.
- `filter_kwargs` is marked for deprecation, and invites the developer to override `get_object` or `get_queryset` instead.
- `context_modifiers` are marked for deprecation. No replacement, developers should use Django's `get_context_data` instead.

Using any of those in a view will still work for now, but trigger a warning pointing at the view and advising the developer to update it. The plan is to change from warnings to exceptions on release 1.3 and drop the old names on release 1.5.

As a benefit, hvad now offers fully featured, Django-compliant `TranslatableCreateView`, `TranslatableUpdateView` and `TranslatableDeleteView`, as well as `TranslatableFormMixin`, all of them being fully tested. Deprecation path is tested as well.