djangosnippets.org: Latest snippets tagged with '_html_output'https://djangosnippets.org/tags/_html_output/2007-06-04T07:28:22.346921-05:00Changing the look of newforms as_table with a custom BaseForm
2007-06-04T07:28:22.346921-05:00bikeshedderhttps://djangosnippets.org/snippets/262/<p>I wanted to mark rows with an erroneous input with 'class="error"' and move the errorlist below the input tag so I wrote a NormalRowFormatter which behaves like a format string by overwriting __mod__.</p>
<p>Examples:</p>
<pre><code>class MyForm(PrettyBaseForm, forms.Form):
# add your fields here
SomethingForm = form_for_model(Something, form=PrettyBaseForm)
</code></pre>
Freely redistributable