- def post_init(self, **kwargs):
- instance = kwargs.get('instance', None)
- value = self.value_from_object(instance)
- if (value):
- setattr(instance, self.attname, loads(value))
- else:
- setattr(instance, self.attname, None)
+ def set_value(model_instance, json):
+ return setattr(model_instance, self.attname, dumps(json))
+ setattr(cls, 'set_%s_value' % self.name, set_value)