I have an object called customer that I trying to initialize from a
large XML parse.  I parse the XML into a dictionary into something
like

customerdict = {'first_name' : 'mike', 'last_name' : 'c', 'etc' :
'etc' } and so forth

then I try to do c = Customer(customerdict).save()

I get a "Can't Adapt" error.

However, if I manually pass in each variable like so:

c = Customer(first_name = customerdict['first_name'], last_name =
customerdict['last_name']).save()

it works fine.

Passing in each variable would be a huge PITA plus any changes to the
model would require changes in multiple places while parsing and
passing the dictionary wouldn't require any changes.  What am I doing
wrong?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to