On Fri, 2008-10-10 at 13:34 +0200, Matias Surdi wrote:
> The same I do
> 
> {{form.interface.initial}}

Assuming you mean that "interface" is one of your form fields here (and
why make us guess if that's the case?), this isn't a very robust way of
getting the initial value. The initial value could have been passed into
the form, not just set on the field.

> 
> I'd like to do something like
> 
> {{form.interface.value}}

Both these situations are really the same case. You want the value that
is rendered in the "value" attribute of the form field (at the HTML
level, there's no difference between initial value or supplied data
values for bound forms -- they're all just displayed in a form the same
way).

It turns out you'll need to replicate the logic in
django.forms.forms.BoundForm.as_widget. If you're going to do this
frequently, it's probably worth writing a filter that accepts a
BoundField instance (which is what form.interface is in your initial
code, if "interfaace" is a form field) and returns that value.

Regards,
Malcolm



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