Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reversible, named URLs for Django flatpages (or multilingual-ng)?

Is there a way to have reversible, named URLs for Django flatpages (or multilingual-ng, which is flatpages + translations)?

If not, is there a similar app available which can have named URLs for pages which are editable through the admin? (And I'd rather avoid any behemoth CMSs, please.)

edit: Please see the comments in the answers below for more discussion and clarification of the question.

like image 879
aehlke Avatar asked Dec 08 '22 01:12

aehlke


1 Answers

As the very last thing in your root URLConf, put

(r'^(?P<url>.*)$', 'django.contrib.flatpages.views.flatpage'),

Now you can use the {% url %} tag, with the view name flatpage and the keyword argument url. You can also use the reverse() function in views.

like image 80
James Bennett Avatar answered Dec 09 '22 14:12

James Bennett