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)
This commit is contained in:
Magnus Hagander
2009-12-28 14:18:53 +01:00
parent ab1b585e53
commit e41c85bd00
2 changed files with 7 additions and 0 deletions

View File

@ -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))

View File

@ -2,6 +2,12 @@
{%block contents%}
<h1>Edit {{formitemtype}}</h1>
<form method="post" action=".">
{%if form_intro%}
<p>
{{form_intro|safe}}
</p>
{%endif%}
<table class="pgGenericFormTable">
{{form.as_table}}
</table>