id summary reporter owner description type status component version severity resolution keywords cc stage has_patch needs_docs needs_tests needs_better_patch easy ui_ux 7511 Automatically generate templates for newforms Daniel Pope nobody "One of the problems with using newforms at the moment is that while the {{{form.as_*()}}} methods offer a shortcut for generating a functional form, there is no simple migration path to go from using {{{{{form.as_p}} }}}in templates, to the template syntax for the same, as is necessary for further customisation. I suggest there should be a management command to generate template code for a given form: With this in myapp/myproject/forms.py: {{{ class MyForm(forms.Form): name = forms.CharField(help_text=u""Lorem ipsum dolor sit amet"") type = forms.ChoiceField(choices=[('a', 'Type A'), ('b', 'Type B')], widget=forms.RadioSelect) }}} you might do: {{{ $ python manage.py formtemplate myapp.myproject.forms.MyForm

{{form.name.label_tag}} {{form.name}}

{{form.name.help_text}}

{{form.name.errors}}

{{form.type.label_tag}}

{{form.type}} {{form.type.errors}} }}} This could be pasted or piped into a template. There is some complication for the same reason as #6388, as illustrated above, and the choice of what to output statically at compile time and what to determine at runtime is somewhat arbitrary. But the aim of this tool would be to assist in generating something editable, so if the form has been made dynamic in some way (eg. {{{self.fields}}} modified in the form constructor) this would still provide a useful foundation to customise manually." New feature closed Forms dev Normal wontfix wishlist Design decision needed 0 0 0 0 0 0