Use the new ContextMixin from Django 1.5 #27
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Django 1.5 introduces the ContextMixin to solve problems with multiple mixins defining get_context_data. It also sets the 'view' variable that points to the View which is quite handy. For more information, see the documentation: https://docs.djangoproject.com/en/dev/ref/class-based-views/mixins-simple/#contextmixin and the ticket that introduced it: https://code.djangoproject.com/ticket/16074
This patch adds support for using ContextMixin. I also modified the get_context_data methods to be all in the same style as the mixins in Django 1.5, so that it is clear what is going on and overriding variables will always work in the same way.
For earlier Django versions I added our own version of ContextMixin. I tested with both 1.4 and 1.5 and all tests pass with both versions.