New Odd Error: Caught VariableDoesNotExist while rendering: Failed lookup for key [request] in u'[{},

490 views
Skip to first unread message

Dave Merwin

unread,
Jun 2, 2010, 1:32:13 AM6/2/10
to Django FeinCMS
Anyone have any ideas what this is about? I get the error below
anyotme I try to call {% feincms_render_region feincms_page "sidebar"
request %} in a template. Or some version of that. I'm running Django
1.2.1. This is a new error. since I have installed 1.2.1.

Caught VariableDoesNotExist while rendering: Failed lookup for key
[request] in u'[{}, {\'csrf_token\':
<django.utils.functional.__proxy__ object at 0x102a76f90>}, {\'perms
\': <django.utils.functional.__proxy__ object at 0x102a76610>,
\'messages\':
<django.contrib.messages.storage.user_messages.LegacyFallbackStorage
object at 0x102a76a10>, \'user\':
<django.utils.functional.SimpleLazyObject object at 0x102a76150>},
{\'feincms_page\': <Page: Hello All>, \'feincms_site\':
<django.contrib.sites.models.RequestSite object at 0x102a31650>},
{\'block\': <Block Node: content_block. Contents: [<Text Node: \'\n
<div id="con\'>, <Block Node: breadcrumbs. Contents: []>, <Text Node:
\'\n \'>, <Block Node: content. Contents: []>, <Text Node: \'\n \'>,
<Block Node: sidebar. Contents: [<Text Node: \'\n \'>, <Block Node:
sidebar_one. Contents: []>, <Text Node: \'\n \'>, <Block Node:
sidebar_two. Contents: []>, <Text Node: \'\n \'>]>, <Text Node: \'\n </
div>\n \'>]>}, {\'block\': <Block Node: sidebar. Contents: [<Text
Node: \'\n\n <div id="sidebar" c\'>, <Block Node: sidebar_one.
Contents: [<Text Node: \'\n\n <div id="si\'>]>, <Text Node: \'\n\n
\'>, <Block Node: sidebar_two. Contents: [<Text Node: \'\n <div id="sid
\'>, <Variable Node: feincms_page.title>, <Text Node: \'" <span>you
might also li\'>, <django.template.SimpleNode object at 0x102a46cd0>,
<Text Node: \'\n \n \'>]>, <Text Node: \'\n \n </div>\n \n\'>]>},
{\'block\': <Block Node: sidebar_two. Contents: [<Text Node: \'\n <div
id="sid\'>, <Variable Node: feincms_page.title>, <Text Node: \'"
<span>you might also li\'>, <django.template.SimpleNode object at
0x102a46cd0>, <Text Node: \'\n \n \'>]>}]'

Matthias Kestenholz

unread,
Jun 2, 2010, 1:40:18 AM6/2/10
to django-...@googlegroups.com
On Wed, Jun 2, 2010 at 7:32 AM, Dave Merwin <dave....@gmail.com> wrote:
> Anyone have any ideas what this is about? I get the error below
> anyotme I try to call {% feincms_render_region feincms_page "sidebar"
> request %} in a template. Or some version of that. I'm running Django
> 1.2.1. This is a new error. since I have installed 1.2.1.
>

I can't make much sense from the error message, but it seems that for
some reason the request isn't available in the template. Did you use
RequestContext and do you have django.core.context_processors.request
in your TEMPLATE_CONTEXT_PROCESSORS? Not all content types need the
request, but f.e. the ContactFormContent and ApplicationContent won't
work without it.


Matthias

David Merwin

unread,
Jun 2, 2010, 1:59:53 AM6/2/10
to django-...@googlegroups.com
You were right, that was it.

Something to note. In Djaango 1.2.1, when I ran

$ django-admin.py startproject test2

The TEMPLATE_CONTEXT_PROCESSORS was not installed. Therefore, django.core.context_processors.request was not added. I wasn't using the contact form or the ApplicationContent. Just Pages and Blog. And they were breaking.

Hope that helps someone else. Thanks Matthias.




--
You received this message because you are subscribed to the Google Groups "Django FeinCMS" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-feincm...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-feincms?hl=en.




--
Dave Merwin

http://facebook.com/davemerwin
http://twitter.com/davemerwin
http://www.davemerwin.com
My Profile: http://www.linkedin.com/in/merwin
541.335.1832

Matthias Kestenholz

unread,
Jun 2, 2010, 2:06:03 AM6/2/10
to django-...@googlegroups.com
On Wed, Jun 2, 2010 at 7:59 AM, David Merwin <dave....@gmail.com> wrote:
> You were right, that was it.
> Something to note. In Djaango 1.2.1, when I ran
> $ django-admin.py startproject test2
> The TEMPLATE_CONTEXT_PROCESSORS was not installed.
> Therefore, django.core.context_processors.request was not added. I wasn't
> using the contact form or the ApplicationContent. Just Pages and Blog. And
> they were breaking.

Just a little bit of clarification:

If you use the feincms rendering tags, you need the request of course,
because you are passing it to the template tag. The content types
themselves do nothing with it, they just ignore the additional
arguments.

Btw, if you aren't using frontend editing or content types requiring a
request, you could replace

{% feincms_render_region feincms_page "main" request %}

with

{% for content in feincms_page.content.main %}{{ content.render }}{% endfor %}

If you use {{ content.render }}, you cannot pass a request and that's
(nearly) the only reason for the feincms_render_* template tags to
exist.

Matthias

Reply all
Reply to author
Forward
0 new messages