Hey,

I'm working on upgrading to Django 1.11 and have encountered an issue with 
simple_tags making use of context. I need to access the context within the 
tag so declare the decorator as follows.

@register.simple_tag(takes_context=True)


However when I print the type of context at this stage it is an instance of 
RequestContext. Is this expected behaviour? Because if you wanted todo a 
render_to_string at the end of the template tag, it'll throw an "unexpected 
type" error as context as required as a dict but not an instance of 
RequestContext

my return statement

renderedMessage = render_to_string(template, context)
return mark_safe(renderedMessage)


Regards

Murat

-- 
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/3f45cfb7-5028-46ea-8004-d340dbd6b995%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to