Closed vintage closed 5 years ago
@vintage I think what you're saying is that if you pass a RequestContext
to render_block_to_string
it gets rewritten to be a Context
instances instead of a RequestContext
. Is that accurate?
I've been unable to find any documentation for make_context
, am I missing it somewhere?
Any thoughts on adding a test for this?
@clokep That's exactly the case, as right now it's not possible to pass RequestContext
down to the block rendering (which I need to accomplish in current project). I've removed the use of make_context
as indeed it's not documented anywhere in the official docs - replaced it with more understandable approach, as well with unit test to see how its working.
For some reason the newly added test is failing on Travis (works locally), any ideas?
I've managed to fix the breaking test, but there is still some problem with the Travis itself Error creating virtualenv. Note that some special characters
- https://github.com/pytest-dev/pytest/issues/2779
I'll try to fix the issue with travis in a separate branch.
Hey, got any news about this one?
Hi, Thx @vintage for the PR. @clokep, could you plan to merge this PR ?
Sorry for the extreme delay on this. Overall it looks reasonable. I left a couple of comments, but can always make these changes myself if necessary. Do you know if Jinja has any similar concept to this?
Also it would be great if we could update the README with some examples / API changes and the changelog too!
@clokep AFAIK Jinja do not provide any concept near the Django RequestContext. I've also updated the README
about the new optional parameter.
Thanks for this improvement! I'll probably try to do a couple minor things before releasing. 👍
@vintage FYI I just pushed version 0.6 with this change in it!
@clokep Awesome, great to hear that <3
Thx guys !
The current implementation hard-codes use of the
Context
instance, but lots of apps are usingRequestContext
instead - https://docs.djangoproject.com/en/2.0/ref/templates/api/#django.template.RequestContextRefactor context creation to take into account, that both classes are supported by using Django built-in method called
make_context
.