which generates a lot of redundant, useless, ugly code which also slows down development.
One solution could be to not use null=True at all, but at the present moment the only way i could find to add an hstore field to an existing database table is setting the default value to NULL, which makes possible to add the field in the table but renders development clunky.
I propose that the fallback value of an HStoreField must always be an empty HStoreDict, even when null values are allowed.
When the null attribute is set to
True
in aDictionaryField
, the behaviour sucks.Because the default value of the dictionary becomes
None
, trying to setting or getting keys from the dictionary returns aTypeError
exception:set
example:get
example:These two lines both generate an exception.
To mitigate this, one would always have to do something like:
or:
which generates a lot of redundant, useless, ugly code which also slows down development.
One solution could be to not use
null=True
at all, but at the present moment the only way i could find to add an hstore field to an existing database table is setting the default value toNULL
, which makes possible to add the field in the table but renders development clunky.I propose that the fallback value of an
HStoreField
must always be an emptyHStoreDict
, even when null values are allowed.