On 05/24/2011 09:35 AM, Gregor Müllegger wrote:
>> 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

This looks like a pretty good starting point to me.

Since we're building on top of Bruno's templated widgets, I think it
would also be quite useful if you could override the default widget
templates in your layout, just by placing the properly named file at the
right location. So if a widget uses the template
forms/widgets/textarea.html, and you're using "mycustom" layout, it
would first look for a template at
"forms/layouts/mycustom/widgets/textarea.html".

> 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.

Yeah. I guess it would be possible to squeeze this into the {% form %}
(nee {% renderform %}) tag with some syntactical modifiers, e.g.:

{% form "myfield:errors" %}

Or even with a filter?

{% form "myfield"|fielderrors %}

But it may be cleaner just to do it as a separate tag.

Carl

-- 
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.

Reply via email to