djangonauts / django-hstore

PostgreSQL HStore support for Django.
http://django-hstore.readthedocs.io/
Other
517 stars 142 forks source link

HStoreDict.__unicode__() returns empty string when dict is empty #71

Closed montegoode closed 9 years ago

montegoode commented 9 years ago

Don't know if this is a bug, but the when an HStoreDict does not have any elements in it, the unicode method returns '' rather than '{}'. The main manifestation of this is under django-rest-framework - the browsable api will not render an empty dict in the HTML Form for user editing even though the model field has been initialized with an empty dict (and not a null).

nemesifier commented 9 years ago

Thank you for reporting this. I'll look into it later today as I'm going to issue a new release soon and I might include this improvement in it.

Bytheway, did you know about django-rest-framework-hstore? https://github.com/djangonauts/django-rest-framework-hstore

nemesifier commented 9 years ago

Fixed and new release issued, try and let me know. https://github.com/djangonauts/django-hstore/releases/tag/1.3.3

montegoode commented 9 years ago

Fantastic! Thanks for fixing it - pulled the new version and it works like a charm. And yes, I know about DRF-hstore - I'm using that as well! :)