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.

Reply via email to