From e41c85bd0047e52e02680e34e7a577751f9b3031 Mon Sep 17 00:00:00 2001 From: Magnus Hagander Date: Mon, 28 Dec 2009 14:18:53 +0100 Subject: [PATCH] Support short introductory text on a form driven from the model, without the need to create a separate template. (Anything more advanced should still use a template, of course) --- pgweb/util/helpers.py | 1 + templates/base/form.html | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pgweb/util/helpers.py b/pgweb/util/helpers.py index aa43aa65..126b271c 100644 --- a/pgweb/util/helpers.py +++ b/pgweb/util/helpers.py @@ -38,5 +38,6 @@ def simple_form(instancetype, itemid, request, formclass, formtemplate='base/for 'form': form, 'formitemtype': instance._meta.verbose_name, 'markdownfields': markdownfields, + 'form_intro': hasattr(form, 'form_intro') and form.form_intro or None, }, NavContext(request, navsection)) diff --git a/templates/base/form.html b/templates/base/form.html index 2a5b6caf..b18d3f87 100644 --- a/templates/base/form.html +++ b/templates/base/form.html @@ -2,6 +2,12 @@ {%block contents%}

Edit {{formitemtype}}

+{%if form_intro%} +

+{{form_intro|safe}} +

+{%endif%} + {{form.as_table}}