0

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 .

Raido
  • 63
  • 2
  • 6
  • Due to the static nature of flatpages [and probably their URLs], and to avoid named URLs machinery, I'd rather recommend static [hardcoded] URLs for sitetree items. – idle sign Jan 06 '14 at 04:18

1 Answers1

0

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.

sk1p
  • 6,645
  • 30
  • 35
  • Were you able to get this working with more then one flatpage ? I've set up a project with just the flatpages and sitetree packages but the resulting navigation tree only shows the current flatpage in the menu. (I thought I'd ask here before posting a full blown question) – Carel Oct 10 '14 at 14:31