On Saturday 03 Dec 2005 5:50 pm, Robert Wittams wrote:
> Kenneth Gonsalves wrote:
> > On Saturday 03 Dec 2005 4:48 pm, Robert Wittams wrote:
> >>Kenneth Gonsalves wrote:
> >>>hi,
> >>>when using AddManipulator and returning the form for
> >>> correcting errors, the select field does not get populated
> >>> with the choice selected. I could do this manually, but does
> >>> django have a way of doing it automatically?
> >>
> >>If using trunk, are you using flatten_data as directed in
> >>
> >>http://code.djangoproject.com/wiki/NewAdminChanges ?
> >
> > this only describes how to do it in ChangeManipulator - i used
> > flatten_data in the AddManipulator like this:
> >
> > if request.POST:
> >         data = request.POST.copy()
> >         errors = manipulator.get_validation_errors(data)
> >         manipulator.do_html2python(data)
> >         data = manipulator.flatten_data()
>
> Erm...throwing away the data we got from the POST...
>
> >         if not errors:
> >
> >             enquiry = manipulator.save(data)
> >             return HttpResponseRedirect("/yyy/xxx/")
> >
> > but the select field still didnt get populated
>
> Why are you flattening the data again? You only do this once,
> when extracting the data out of the object instance (or the
> defaults). The data is already 'flat' when it comes out of a
> POST. do_html2python gets it back into a form suitable for both
> saving and populating form fields.
>
> What you are doing here is getting the default data out of the
> manipulator again as far as I can tell.

ok - it works now thanks

-- 
regards
kg

http://www.livejournal.com/users/lawgon
tally ho! http://avsap.org.in
ಇಂಡ್ಲಿನಕ್ಸ வாழ்க!

Reply via email to