Thanks Javier but I'm having problems with that. I do want to create a dictionary from the model first then override with the POST values. But when I try to make a dictionary from the model I get an 'object is not iterable' error.
On Feb 15, 9:41 pm, Javier Guerra <jav...@guerrag.com> wrote: > On Mon, Feb 15, 2010 at 4:27 PM, cootetom <coote...@gmail.com> wrote: > > I'm looking for something in the framework that I think must exist > > somewhere but can't seem to find anything. I'm after a bit of code > > that takes a dictionary (a.k.a the POST dictionary) and a model > > instance, then merges the two into a new dictionary. The new > > dictionary then contains all values from the POST plus any missing > > values added from the model. > > try: > > new=dict (request.POST) > new.update (modelInstance) > > or the other way around, if you want the POST to override the model: > > new=dict(modelInstance) > new.update (request.POST) > > -- > Javier -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.