I know it's very early release, but I'd expect the example from the docs to work. I started playing with HStoreField from django.contrib.postgres.fields, and get the error above. Model Dog is copied verbatim from https://docs.djangoproject.com/en/dev/ref/contrib/postgres/fields/#querying-hstorefield, and then in the shell,
-- >>> from atest.models import Dog
>>> Dog.objects.create(name='Rufus', data={'breed': 'labrador'})
...
return self.cursor.execute(sql, params)
django.db.utils.ProgrammingError: can't adapt type 'dict'
At that moment,
sql = 'INSERT INTO "atest_dog" ("name", "data") VALUES (%s, %s) RETURNING "atest_dog"."id"'
params = ('Rufus', {'breed': 'labrador'})
So, everything should be completely normal - yet, HStoreField somehow doesn't know how to accept dict, despite docs saying that it's exactly what it should accept. Does anyone have any advice? Has anyone tried to do something with HStoreField?
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d891d17f-3978-43fb-ae85-8dea13855a57%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment