On 10/29/06, shidan <[EMAIL PROTECTED]> wrote:
>
> Hi, I want the same functionality as the ChangeManipulator where it
> prepopulates the form with
> the current values of the object, how can I do this with  custom form
> manipulator.

Add flatten_data to it and call if when initializing new_data. Short snippet:

    class CustomManipulator(forms.Manipulator):
             def __init__(self):
                  ...
             def flatten_data(self):
                 new_data = {
                   ....
                 }
            return new_data

    ...

    if request.POST:
       ...
    else:
        errors = {}
        new_data = manipulator.flatten_data()

    form = forms.FormWrapper(manipulator, new_data, errors)



jure

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" 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-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to