Django: ProgrammingError: Can’t Adapt
I find I get an error like this far too often, but not often enough to remember why I got the problem the previous time. For my own sanity, I’m blogging about it for reference. The error itself is not very descriptive:
Exception Type: ProgrammingError
Exception Value: can’t adapt
Unless there is something I’m forgetting, it seems 100% of the time it has been a simple error. I use the get_or_create function to retrieve a model, but I don’t account for the “created” variable. So then I try to use the tuple as a model object somewhere and it throws this error.
For example, here is the wrong way:
person = Person.objects.get_or_create(first_name="Dustin", last_name="Davis") print person.first_name
And now for the correction:
person, created = Person.objects.get_or_create(first_name="Dustin", last_name="Davis") print person.first_name
No related posts.
Related posts brought to you by Yet Another Related Posts Plugin.
January 28, 2010
·
Dustin ·
12 Comments
Tags: django · Posted in: Programming & Internet
-
Eric
-
http://gu-at.com Brent
-
Jiri Barton
-
http://trespams.com aaloy
-
http://www.bestonlinetattoodesigns.com tattooboy
-
http://bestbuylaptop.redtor.com/ suphancyber
-
http://www.billigelaan.com/ Lån Penge
-
http://heritageinstallationsltd.co.uk/double-glazing/addiscombe Double Glazing Addiscombe
-
http://www.retailmakeupstore.com Retail Makeup Store
-
Harel Malka
-
podja
-
Erik Näslund


