Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Deprecation warning in Django 1.9 #292

Closed
wants to merge 2 commits into from
Closed

Conversation

jieter
Copy link
Member

@jieter jieter commented Dec 10, 2015

about first param to template.render:

[...]bootstrap3/utils.py:142: RemovedInDjango110Warning: render() must be called with a dict, not a Context.
  return template.render(Context(context))

Fixes #279 and #290

about first param to `template.render`:
```
/home/jieter/.virtualenvs/bootstrap/local/lib/python2.7/site-packages/bootstrap3/utils.py:142: RemovedInDjango110Warning: render() must be called with a dict, not a Context.
  return template.render(Context(context))
```
@jieter
Copy link
Member Author

jieter commented Dec 10, 2015

Hmm, I see I need to run the tests locally to see what's wrong, I only copied the patch which made the warnings go away, but didn't run the tests on it... Hang on.

@jieter
Copy link
Member Author

jieter commented Dec 10, 2015

Hmm, this is more complicated than I anticipated. It turns out templates returned from get_template() do not the context arg as a Context object, but removing all wrapping in Context yields errors here.

Got it fixed for django 1.8/1.9 now, other versions still fail.

@nikolas
Copy link
Contributor

nikolas commented Dec 17, 2015

I think django-bootstrap3 should discontinue support for at least django versions 1.4-1.6, since these are no longer supported by the django project.

@dyve
Copy link
Member

dyve commented Dec 21, 2015

I agree, but I still have 1 project on 1.6 myself, so I'm postponing dropping 1.6 support until that one is migrated (should be soon).

@dyve
Copy link
Member

dyve commented Dec 21, 2015

For now, CI related pull requests should have passing Travis tests, so I am not pulling this in.

@dyve dyve closed this Dec 21, 2015
@troygrosfield
Copy link

@jieter, why doesn't the code just do something along the lines of:

if django.VERSION >= (1, 9):
    # do django 1.9 and up stuff

That makes the change passive with older django versions and removes the deprecation warning from django 1.9 and up.

@jieter
Copy link
Member Author

jieter commented Jan 22, 2016

@troygrosfield yeah, that'll work. I did that for django-tables2

@dyve
Copy link
Member

dyve commented Feb 12, 2016

Fix is in place now in develop branch, but I think it's ugly. Improvements welcome, as long as tests pass (keep Travis and tox happy).

@jieter
Copy link
Member Author

jieter commented Feb 12, 2016

pff, PITA

@dyve
Copy link
Member

dyve commented Feb 12, 2016

I dropped support for Django < 1.8 and python < 2.7 for this issue amongst others, so maybe that'll help. I strongly suspect a bug in Django that makes some templates still require Context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants