[Pulp-dev] JSON Field Implementation
Patrick Creech
pcreech at redhat.com
Tue Aug 23 20:02:32 UTC 2016
On Tue, 2016-08-23 at 15:53 -0400, Brian Bouterse wrote:
> One related comment on this is my desire to avoid getters and setters.
>
> For example let's say my_field is the JSON field. I hope we can do this:
>
> my_model = TheModelClass()
> my_model.my_field = {'a': 1, 'b': 2} # this is setting with a dict
> my_mode.save() # the field contents are now JSON serialized in the DB
This will be abstracted, as it is on all other models to work like this.
> Also this:
>
> my_model = TheModelClass.get(pk='12345')
> type(my_model.my_field) # This would show dictionary not string
I'm not sure of what the resulting type it will definitely show is, but I am fairly confident it
will not be a string, as the whole point of implementing the custom field is to abstract away the
underlying storage mechanism's data format with the data format the code is excpecting to work with.
> Is that possible with this implementation idea? What do others think
> about this?
>
> Thanks for doing this @pcreech!
No problemo!
> -Brian
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/pulp-dev/attachments/20160823/37c7e20e/attachment.sig>
More information about the Pulp-dev
mailing list