From 4c4b6ef11febe13f6bb7db4510e115853aca50a5 Mon Sep 17 00:00:00 2001 From: Martin Green Date: Mon, 8 Aug 2011 10:04:59 +0100 Subject: [PATCH] Allow pages to be rendered when the body tag has attributes. Put an edit link on the homepage. --- flatpages/views.py | 2 +- templates/flatpage.html | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flatpages/views.py b/flatpages/views.py index 1a445ea..a080437 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -56,7 +56,7 @@ def flatpage(request, path): if path.endswith(".htm") or path.endswith(".html"): html = o.read() - m = re.search(r"(.*).*(.*)", html, re.DOTALL) + m = re.search(r"(.*).*]*>(.*)", html, re.DOTALL) if m: head, body = m.groups() else: diff --git a/templates/flatpage.html b/templates/flatpage.html index 42b8481..fddc69a 100644 --- a/templates/flatpage.html +++ b/templates/flatpage.html @@ -5,6 +5,8 @@ {{ body|safe }} -{% include "menu.html" %} +{% if homepage %}{% if editable %}Edit{% endif %}{%else %}{% include "menu.html" %}{% endif %} + +