On 2/13/06, Adrian Holovaty <[EMAIL PROTECTED]> wrote:
>
> On 2/13/06, Jacob Kaplan-Moss <[EMAIL PROTECTED]> wrote:
> > How about this syntax::
> >
> >         class Admin:
> >                 custom_templates = {
> >                         'field_name1' : 'widget/template_name1',
> >                         'field_name2' : 'widget/template_name2',
> >                 }
> >
> > (i.e. a dict mapping field names to template names).
>
> Seems a bit boilerplatish, compared to a simple list of field names,
> but the advantage of this would be that you could easily reuse
> widget-specific templates. On the other hand, you could reuse
> widget-specific templates with the field-name list by doing a simple
> "{% extends %}" in the template.
>
> I think we should decide: What's more common, reusing widget-specific
> templates or making one-off widget-specific templates? I think my vote
> is for the latter, although I don't feel too strongly about it.

Another option (although I'm not sure that I like it) is to allow
either style. The tuple would use the template lookup described in
Jabob's first email, and the dict would of course allow you to supply
*any* template path. It's more flexible, but it's more to document and
more behavior to remember.

Joseph

Reply via email to