My favorites | Sign in
Project Logo
                
Code license: New BSD License
Labels: django, template, snippet
Show all Featured downloads:
cheap_pages.py
Feeds:
People details
Project owners:
  jjdelc

Methods to use when you just want to use the Django dispatcher and there will be no extra business logic in your pages. In some cases flatpages is too flat, and store templates in DB is too much hassle

A cheap page() method to wrap direct_to_template:

    >>> url(^name/$,
    ...    direct_to_template,
    ...    {'template': 'name.html'},
    ...    name='name')
can be expressed as:
    >>> page('name')

And a cheap build() method to build a patterns() full of direct_to_template

    urlpatterns = patterns('', ...)
    urlpatterns += build('Regexp', ['page1', 'page2', ...])








Hosted by Google Code