On 7/8/07, James Bennett <[EMAIL PROTECTED]> wrote:
> Well, the thing to remember is that you're not just displaying an
> empty input element -- it's fairly common, due to the data validation
> step, to have to go back and show the form again with values filled
> in.

Right, so use:
<input name="{{ fieldname }}" value="{{
form.data.fieldname|escape_filters }}" />

It gets really messy with default values, though.

Hopefully Nathan's tips are enough for you, Al. If not, have your
programmers make a templatetag or filter:
{{ form.fieldname|add_field_attrs:"class='cls'" }}

def add_field_attrs:
  [make a dict out of attrs]
  return form.fieldname.as_widget(form.fieldname.field.widget, attrs)

A templatetag is better, but I outlined a filter because I'm tired.
The proper templatetag would let you keep all the standard
functionality but still give you the power to add any attribute that
you want.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to