I am building a django project using the REST framework. Data is sent through from the front end as a JSON object. I allow for null values to be accepted, and in order to facilitate this I set blank=True, null=True in the relevant places in models.py.
However, I have also used the HStoreField in order to allow arbitrary data to be stored. Now, if the value of an item inside the HStoreField is null, I get an error that:
{"arbitrary_data":["This field may not be null."]}
Is there a solution to this? From my research it looks like HStoreField has to follow a python dict structure, where the key and value are both strings. So perhaps this is the reason why I cannot set the value to null.
Doing something like this:
class Employee(models.Model):
arbitrary_data = HStoreField(null=True, blank=True)
does not help because all it allows is for the whole HStoreField to be null.