> Thanks for the example, but that's not a ModelForm.
>
> Richard

Another try, view.py:

from django.forms.models import model_to_dict

def view(request):
    data = Foo.objects.all()[0]
    print data.start
    form = Example(data=model_to_dict(data))
    return render_to_response('t.html', {'form': form})

Where Example is a ModelForm for model Foo.

Seems like there is no easy way to get access to the initial data of a
field in a template. Example(instance=foo) will only populate the
forms initial dict but not data. Should there be a similar property
for initial in BaseForm as there is for data?

Anssi Kääriäinen

--

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


Reply via email to