Search code examples
djangodjango-flatpagesdjango-sitetree

How get access to flatpages from django-sitetree


Besides portfolio and blog, i have some flatpages in my site. Site tree, breadcrumbs and menu i passed through django-sitetree. And i cant understand how get URI of my flatpages from admin interface with django-sitetree app. With title it is OK - just {{ flatpage.title }}.

Would be glad to see any help .


Solution

  • It seems like sitetree only supports named url patterns or "exact" urls. Because flatpages doesn't have a named url pattern by default, you could create one, like:

    urlpatterns = patterns(
        'django.contrib.flatpages.views',
        url(r'^(?P<url>.*)$', 'flatpage', name='flatpages-page'),
    )
    

    Include that at top level or put it directly in your root urlconf (at the end). And then put flatpages-page flatpage.url into your tree item, check 'URL as Pattern' and it should work.