Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upDeprecation warnings when used with Django 1.9 #553
Comments
jandd
changed the title from
Deprecation warning when used with Django 1.9
to
Deprecation warnings when used with Django 1.9
Dec 19, 2015
carltongibson
added
the
Cleanup
label
Dec 21, 2015
kavdev
referenced this issue
Dec 22, 2015
Closed
Deprecation in Django 2.0: "render() must be called with a dict, not a Context." #429
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kavdev
Dec 22, 2015
Contributor
Two more instances for you:
python3.4/site-packages/crispy_forms/bootstrap.py:90: RemovedInDjango110Warning: The context_instance argument of render_to_string is deprecated.
return render_to_string(template, extra_context, context)
python3.4/site-packages/crispy_forms/templatetags/crispy_forms_tags.py:222: RemovedInDjango110Warning: render() must be called with a dict, not a Context.
return template.render(c)
Related information (new in Django 1.8):
Template objects must provide a render() method whose signature differs slightly from the Django template language’s render().
Instead of:
from django.template import Context from django.template.loader import get_template template = get_template('hello.html') html = template.render(Context({'name': 'world'}))You should write:
from django.template.loader import get_template template = get_template('hello.html') html = template.render({'name': 'world'})And instead of:
from django.template import RequestContext from django.template.loader import get_template template = get_template('hello.html') html = template.render(RequestContext(request, {'name': 'world'}))You should write:
from django.template.loader import get_template template = get_template('hello.html') html = template.render({'name': 'world'}, request)Passing a Context or a RequestContext is still possible when the template is loaded by a DjangoTemplates backend but it’s deprecated and won’t be supported in Django 1.10.
If you’re loading a template while you’re rendering another template with the Django template language and you have access to the current context, for instance in the render() method of a template tag, you can use the current Engine directly. Instead of:
from django.template.loader import get_template template = get_template('included.html')You can write:
template = context.template.engine.get_template('included.html')This will load the template with the current engine without triggering the multiple template engines machinery, which is usually the desired behavior. Unlike previous solutions, this returns a django.template.Template, like get_template() used to in Django 1.7 and earlier, avoiding all backwards-compatibility problems.
|
Two more instances for you:
Related information (new in Django 1.8):
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kavdev
Dec 22, 2015
Contributor
I'm going to put in a pull request in a bit, but fair warning: keeping < 1.8 compatibility will result in some ugly code. (It actually isn't too bad)
|
I'm going to put in a pull request in a bit, but fair warning: keeping < 1.8 compatibility |
kavdev
referenced this issue
Dec 23, 2015
Merged
template.render() no longer takes a Context object as of Django 1.8 #554
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
carltongibson
Dec 23, 2015
Collaborator
If anyone wants a Christmas project, I'd be happy to take a PR on these issues!
|
If anyone wants a Christmas project, I'd be happy to take a PR on these issues! |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@carltongibson: #554? :) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Already merged, but there are other warnings right? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
kavdev
Dec 23, 2015
Contributor
Nope, got all of them. They are all part of the same deprecation. I take that back. Let me look into his second reported warning.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
carltongibson
Dec 23, 2015
Collaborator
@kavdev OK. thanks for the input!
FYI I'm looking for a release the w/b 4th Jan
|
@kavdev OK. thanks for the input! FYI I'm looking for a release the w/b 4th Jan |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@carltongibson: Sounds good. #555 |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Good work @kavdev. Thanks. |
carltongibson
closed this
Dec 23, 2015
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
@kavdev thanks a lot |
jandd commentedDec 19, 2015
When used in a Django 1.9 project crispy-forms code produces some deprecation warnings:
I'm not sure whether this list is complete, but this is all I get in the test suite of one of my projects. I have not observed any wrong behavior in my application yet.