Hi Preston,
2011/5/23 Preston Timmons <[email protected]>:
> This looks interesting so far.
>
> How does setting the form layout affect rendering individual fields in
> a form?
>
> Is the output of {% renderform my_form "first_name" %} equivalent to
> {{ form.first_name }}, or is it more like the output of "as_p" or
> "as_table"?
It's not really equivalent to {{ form.first_name }} because the template
variable would only render the widget. The {% renderform %} is meant to
render complete rows, including field errors, help text, the label etc.
This means you could list all the fields of a form by hand and it would
result in the same output, i.e. the following examples would result in the
same output:
(assuming my_form only has two fields)
{% rendeform my_form "first_name" %}
{% rendeform my_form "last_name" %}
-- or --
{% rendeform my_form %}
> Which templates are involved in a form layout?
This is not yet defined in detail. I would suggest a schema like:
forms/layouts/<layout name>/<template name>.html
Resulting in templates for the layout "table" like:
forms/layouts/table/row.html
forms/layouts/table/label.html
forms/layouts/table/field.html
forms/layouts/table/errors.html
forms/layouts/table/help_text.html
But this might change if we see it fit while using it in sample projects
during the summer.
A note on something different: We haven't specified yet how it will look like
to render just parts of a single field like errors. If we keep the
{{ field.errors }} syntax (which is unlikely since the template variable has
no access to the layout set by {% formlayout %}) or if we use an extra
templatetag for that. A proposal for these details will follow after we have
agreed on the higherlevel things like described in the RFC.
--
You received this message because you are subscribed to the Google Groups
"Django developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.