The flatpages view is not provided the context which includes 'posts'.

IMO you are correct with the {% load posts %} technique because it is 
entirely as result of the template you are using that requires you display 
that information -- if that makes sense.

In other words it's not because of the flatpage you are loading but rather 
the template you are using which necessitates the 'posts' being used.

On Wednesday, December 19, 2012 8:40:21 PM UTC-8, Frank Valcarcel wrote:
>
> I have a Django app called blogengine which does exactly what the name 
> implies. I can't seem to get data from blogengine (posts) to display in 
> templates when they're called by flatpages. I'm new to Django but I assume 
> this is a urls.py issue.
>
> My urls.py:
>
> from django.conf.urls.defaults import patterns, include, urlfrom 
> blogengine.views import PostsFeed
> # Uncomment the next two lines to enable the admin:from django.contrib import 
> admin
> admin.autodiscover()
>
> urlpatterns = patterns('',
>     # Uncomment the admin/doc line below to enable admin documentation:
>     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
>
>     # Uncomment the next line to enable the admin:
>     url(r'^admin/', include(admin.site.urls)),
>
>     # Home page
>     url(r'^$', 'blogengine.views.getPosts'),
>     url(r'^(\d+)/?$', 'blogengine.views.getPosts'),
>
>     # tinyMCE
>     (r'^tinymce/', include('tinymce.urls')),
>
>     # Blog posts
>     url(r'^\d{4}/\d{1,2}/([-a-zA-Z0-9]+)/?$', 'blogengine.views.getPost'),
>
>     # Categories
>     url(r'^categories/(\w+)/?$', 'blogengine.views.getCategory'),
>     url(r'^categories/(\w+)/(\d+)/?$', 'blogengine.views.getCategory'),
>
>     # Comments
>     #url(r'^comments/', include('django.contrib.comments.urls')),
>
>     # RSS feeds
>     url(r'^feeds/posts/$', PostsFeed()),
>
>
>     # Flat pages
>     #url(r'', include('django.contrib.flatpages.urls')),
>     #not needed since '...middleware.FlatpageFallbackMiddleware' is installed 
> in settings.py
>
> )
>
> Would it be better practice to create a tag so I could just call {% load 
> posts %} when and where I need it?
>
> I can call them up by normal means by using  {% if posts %}...{% for post 
> in posts %}  but trying to use this in flatpages that call the same 
> template section of the page displays nothing. Any ideas?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/5EhD9WhaRREJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to