Closed peterfarrell closed 4 years ago
@peterfarrell Might also take a look at Postgres JSONField form field.
@peterfarrell Might also take a look at Postgres JSONField form field.
Thanks @jackton1 for the suggestion. I thought about it, but given the data I have -- this seems like a better choice. Also, Django Rest Framework has a DictField and a ListField:
https://www.django-rest-framework.org/api-guide/fields/#dictfield
I added support for ListField to have parity.
I am tempted to add additional features akin the ListField and DictField in the Django Rest Framework:
https://www.django-rest-framework.org/api-guide/fields/#listfield
@jackton1 @c17r Let me know your thoughts. I know they are issues related to using DRF serializers in addition to form fields. I think you ever went that direction -- we'd need these fields in the PR to keep parity.
@peterfarrell thanks for the contribution!
@c17r Thanks, let me know when we can get a build on PyPi.
I am tempted to add additional features akin the ListField and DictField in the Django Rest Framework:
https://www.django-rest-framework.org/api-guide/fields/#listfield
@jackton1 @c17r Let me know your thoughts. I know they are issues related to using DRF serializers in addition to form fields. I think you ever went that direction -- we'd need these fields in the PR to keep parity.
@peterfarrell
Definitely like the idea you could take a look json-models for things like dict/json validation or using child
pattern for values validation personally I use SimpleArrayField which enforces the expected child types ATM.
@jackton1 Thanks. I'll put some thought into it. I was leaning towards the DRF parameters just for simplicity assuming that if you're using Django -- you are likely using DRF for REST API / etc.
Hey @c17r, this solves some problems we're running into as well. Any plan to push a new release to PyPi soon?
We need @mixxorz for that I don't have PyPi access for this project.
Ah got it! Good to know for the future. :-)
I've just published a new release. 0.7.0
There is no way using Django Forms to pass around arbitrary dictionaries. The only other way was to override
__init__
and pass the dictionary "input" as a kwarg which is a hack. This is a shim to support passing dictionaries to services:PR includes tests.