djangosnippets.org: Latest snippets tagged with 'baseform'http://djangosnippets.org/tags/baseform/2007-07-14T10:40:41.809290-05:00Hidden Forms
2007-07-14T10:40:41.809290-05:00insinhttp://djangosnippets.org/snippets/316/<p>Have your forms descend from this BaseForm if you need to be able to render a valid form as hidden fields for re-submission, e.g. when showing a preview of something generated based on the form's contents.
</p>
<p>Custom form example:
</p>
<pre><code>>>> from django import newforms as forms
>>> class MyForm(HiddenBaseForm, forms.Form): …</code></pre>
Freely redistributableChanging the look of newforms as_table with a custom BaseForm
2007-06-04T07:28:22.346921-05:00bikeshedderhttp://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 redistributableform_for_model / instance customized save and model aware validation
2007-05-13T14:49:05.303133-05:00fivethreeohttp://djangosnippets.org/snippets/232/<p>A way to make form_for_model more customizable.</p>
Freely redistributable