开发者

Django 1.3 - RequestContext not rendering to template

I am trying to simply render {{ request.user }} from my base template and for whatever reason it is not rendering anything. I have even tested trying to return {{ request }} to no avail.

I am currently using django-annoying to render to the template (render_to) and have tried to switch back to using django.templates.RequestContext and that hasn't worked either.

I have a feeling it has something to do with caching, but I have edited my template to show test - {{ request }} and "test - " shows up just fine.

I have also tried to upgrade my django to 1.4 alpha to see if it resolves my issue.

This does not send the request to the template

@render_to('profile/index.html')
def home(request):
    return {}

This works

@render_to('profile/index.html')
def home(request)开发者_Python百科:
    return {'request': request}

However, if I pass 'request': request into the template everything works.

Link to settings.py

I can give any more information that is requested.


You need to add the django.core.context_processors.request context processor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜