Thanks for the reply.

So I guess there are actually now two types of templates, and they have 
incompatible API. Neither is deprecated.

Has this confused anyone else? Is this a desirable/necessary situation?

I think in order to have consistent template usage in our project we really 
need to just use the new-style templates, which means we have to avoid 
using `django.template.Template` at all. Perhaps it could be deprecated and 
removed?

Cheers
Craig de Stigter

On Monday, 12 March 2018 11:21:41 UTC+13, Daniel Roseman wrote:
>
> On Sunday, 11 March 2018 21:06:51 UTC, Craig de Stigter wrote:
>>
>> Hi folks
>>
>> I'm upgrading a large app from 1.8 to 1.11 and coming up against this as 
>> I traverse through django 1.9:
>>
>> >>> from django.template import engines, Context
>> ... t = engines['django'].from_string('')
>> ... t.render(Context({}))
>> ...
>> /path/to/bin/django-admin.py:3: RemovedInDjango110Warning: render() must 
>> be called with a dict, not a Context.
>>
>>
>> This is a surprising warning to me, since the docs still document the use 
>> of Template.render(Context) in 2.0: 
>> https://docs.djangoproject.com/en/2.0/ref/templates/api/#rendering-a-context
>>
>> Would someone mind explaining this?
>>
>> Cheers
>> Craig de Stigter
>>
>>
>>
> Not the same thing. `t` here is an instance 
> of django.template.backends.django.Template, whose render method takes a 
> dict. If you did:
>
>   from django.templates import Template
>   t = Template('')
>
> then you would have an instance of django.template.base.Template, whose 
> render method takes a context.
>
> I have no idea why the distinction, though.
> -- 
> DR. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/aa356ec2-51d4-45d7-99a3-79ef14c775a5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to