embed latest blog post on site's homepage

67 views
Skip to first unread message

Cromulent

unread,
May 6, 2012, 10:19:23 AM5/6/12
to Django FeinCMS
My homepage is mysite.net. My EB app is at mysite.net/blog. How do I
render the latest blog post from my homepage template? I've got other
stuff on that page and I'd like the latest post to be a part of that.

sbaechler

unread,
May 8, 2012, 4:10:09 PM5/8/12
to django-...@googlegroups.com
Hi

You could use the get_entries template tag which adds the latest x blog posts to the template context as 'entries' :

{% load blog_widgets feincms_tags %}

{% get_entries 1 %}

<h2>{{ entries.0.title }}</h2>

{% feincms_render_region entries.0 "main" request %}


Regards
Simon

Cromulent

unread,
May 9, 2012, 1:04:11 PM5/9/12
to Django FeinCMS
I got a "Caught VariableDoesNotExist while rendering: Failed lookup
for key [request] in '......." on the render_region call. I'd guess
the tags did not load.

Matthias Kestenholz

unread,
May 9, 2012, 3:24:19 PM5/9/12
to django-...@googlegroups.com
On Wed, May 9, 2012 at 7:04 PM, Cromulent <dave....@gmail.com> wrote:
> I got a "Caught VariableDoesNotExist while rendering: Failed lookup
> for key [request] in '......." on the render_region call. I'd guess
> the tags did not load.
>

No, either the template did not receive a RequestContext upon
rendering time (extremely unlikely) or you forgot to add
`django.core.context_processors.request` to the list of
TEMPLATE_CONTEXT_PROCESSORS as is documented here:

<http://www.feinheit.ch/media/labs/feincms/templatetags.html?highlight=context_processors>

Hth
Matthias

Cromulent

unread,
May 9, 2012, 3:32:25 PM5/9/12
to Django FeinCMS
This is my processors list direct from the project's settings.py:

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.core.context_processors.static",
"django.contrib.messages.context_processors.messages",

"django.core.context_processors.request",
)

Perhaps the ordering caused this?

On May 9, 3:24 pm, Matthias Kestenholz <m...@feinheit.ch> wrote:
> On Wed, May 9, 2012 at 7:04 PM, Cromulent <dave.fob...@gmail.com> wrote:
> > I got a "Caught VariableDoesNotExist while rendering: Failed lookup
> > for key [request] in '......." on the render_region call. I'd guess
> > the tags did not load.
>
> No, either the template did not receive a RequestContext upon
> rendering time (extremely unlikely) or you forgot to add
> `django.core.context_processors.request` to the list of
> TEMPLATE_CONTEXT_PROCESSORS as is documented here:
>
> <http://www.feinheit.ch/media/labs/feincms/templatetags.html?highlight...>
>
> Hth
> Matthias

Matthias Kestenholz

unread,
May 9, 2012, 3:38:42 PM5/9/12
to django-...@googlegroups.com
On Wed, May 9, 2012 at 9:32 PM, Cromulent <dave....@gmail.com> wrote:
> This is my processors list direct from the project's settings.py:
>
> TEMPLATE_CONTEXT_PROCESSORS = (
>    "django.contrib.auth.context_processors.auth",
>    "django.core.context_processors.debug",
>    "django.core.context_processors.i18n",
>    "django.core.context_processors.media",
>    "django.core.context_processors.static",
>    "django.contrib.messages.context_processors.messages",
>
>    "django.core.context_processors.request",
> )
>
> Perhaps the ordering caused this?
>

The ordering shouldn't change anything...

Could you post the exact versions of Django, FeinCMS and Elephantblog
you are using (again?). I'm having a real hard time understanding how
this problem could happen.


Thanks
Matthias

Cromulent

unread,
May 9, 2012, 4:03:21 PM5/9/12
to Django FeinCMS
django = 1.3
EB = latest
FeinCMS = I had been using the "next" branch until about a week ago
per outdated EB instructions. Now using the master branch. Is there a
version # located somewhere I can look?
Reply all
Reply to author
Forward
0 new messages