Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Django 1.9 template render warning fix #27

Closed
wants to merge 1 commit into from

Conversation

antwan
Copy link

@antwan antwan commented Sep 28, 2016

This PR fixes a Django 1.9 warning when rendering template using a RequestContext instead of a dict.
As per the [deprecation plan](https://docs.djangoproject.com/en/1.9/_modules/django/template/backends/django/|deprecation plan) since 1.8, it is recommanded to send a dictionnary context instead of a Context or RequestContext object when rendering templates. A warning is raised on Django 1.9, but it won't (immediately) break on Django 1.10 thus making a future error silent.

Tested with Django 1.5 to 1.10.

@coveralls
Copy link

coveralls commented Sep 28, 2016

Coverage Status

Coverage remained the same at 100.0% when pulling da3766c on Antwan86:master into 6ff5563 on prymitive:master.

@prymitive
Copy link
Owner

Thanks for the patch, it does pass all tests but it overrides context object and I'm not 100% sure it wouldn't break anything. My concern is that context might have additional keys used for template rendering as so replacing it with a static 2 element dict will make those keys unavailable. A safer approach would be to convert context object to a dict and inject breadcrumb keys. Please take a look at f2e6b17 and if that works for you update this PR. Thanks again.

@antwan
Copy link
Author

antwan commented Oct 10, 2016

Given the templates used, even if the context had additional keys (it's actually empty), they wouldn't be used anyway.

I'll update the PR though.

@prymitive
Copy link
Owner

Fixed in 17b8879

@prymitive prymitive closed this Oct 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants