further there is the great save_instance function that when coupled with using the __dict__ attribute makes doing custom form to model manipulation really easy.
save_instance(form_instance, model_instance) will update the model instance with the form data ~ Anders On 5/15/07, John Matthew <[EMAIL PROTECTED]> wrote: > 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 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 -~----------~----~----~----~------~----~------~--~---