diff -rupN flatpages/views.py /home/kyle/django/contrib/flatpages/views.py --- flatpages/views.py 2009-01-11 20:48:18.000000000 -0700 +++ /home/kyle/django/contrib/flatpages/views.py 2009-01-11 20:28:21.000000000 -0700 @@ -34,6 +34,18 @@ def flatpage(request, url): else: t = loader.get_template(DEFAULT_TEMPLATE) + # Here we alter the code to allow content to be pulled from an actual file + # This way the flatpages are registered to Django and can be templated, etc + # But the actual content itself resides in a separate file which can be + # version controlled, migrated, etc. + if f.content.endswith(".html"): # will need to be an absolute path + try: + content_file = open(f.content, 'r') + f.content = content_file.read() + content_file.close() + except IOError: + pass # Well... maybe it wasn't a file afterall, fall back gracefully + # To avoid having to always use the "|safe" filter in flatpage templates, # mark the title and content as already safe (since they are raw HTML # content in the first place).