On Wed, Oct 22, 2008 at 6:14 AM, erikcw <erikwickst...@gmail.com> wrote:
>
> Hi all,
>
> I'm working on a project that uses flatpages pretty heavily.  I was
> wondering if there was a way to use named urls with flatpages so that
> I can use reverse() in my other views and {% url flat_privacy_policy
> %} in my templates.
>
> I haven't been able to find anything helpful in the docs so far.  Any
> ideas?

It's definitely possible to do. It depends how you want to approach it
but I find that removing the
django.contrib.flatpages.middleware.FlatpageFallbackMiddleware from
the MIDDLEWARE_CLASSES and manually specifying the flatpages you want
via urlconfs easier to handle (since you can use {% url foo %} in
templates).

In your urlconf you want to have something like:
    url(r'^about/$',
        'django.contrib.flatpages.views.flatpage',
        { 'url': '/about/' },
        name='about'),

and then in your templates you can say {% url about %} and it should
work as advertised. Hope this helps!

Cheers,
Nick

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
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