Ah Ha, now we're getting somewhere!

Let me start searching for that, thank you!!

John

On 5/15/07, James Bennett <[EMAIL PROTECTED]> wrote:
>
>
> On 5/15/07, John M <[EMAIL PROTECTED]> wrote:
> > I wish the custom form option would allow me to bind to a data object,
> > based on field names being the same, that way I could have fields in
> > the form that aren't bound and ones that are, without a lot of hassle.
>
> To do that you want to get a dictionary out of the object, which means
> using the '__dict__' attribute. For example:
>
> my_obj = MyModel.objects.get(pk=1)
> form = MyForm(my_obj.__dict__)
>
> The form is smart enough to take a dictionary-like object and pull out
> the values it wants; that's how it works with request.POST, for
> example.
>
> --
> "Bureaucrat Conrad, you are technically correct -- the best kind of
> correct."
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to