-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for Django 1.8 ArrayField #2496
Conversation
Conflicts: rest_framework/serializers.py
Nice. We'll also want to figure out how to populate the child argument. |
@tomchristie doh yeah, completely missed that. Working on it. |
@tomchristie not sure if that's the best solution. Thoughts? >>> ChessBoardSerializer()
ChessBoardSerializer():
board = ListField(child=CharField(allow_blank=True, allow_null=True, label='Board', max_length=10, required=False), validators=[<django.contrib.postgres.validators.ArrayMaxLengthValidator object>]) |
Very nice! 🚀 I tried adding a test and bumped into the fairly major issue that we'd need to start using postgres as our test database (no, I don't want us to have to do that). Only thing I'd like to see before we commit this is a double check that it really does work for nested array fields. The example you gave above doesn't quite match up to the example in the Django docs, as the representation is only listing |
@tomchristie yeah I'm looking into that. I did |
@tomchristie yeah I think that was an easy fix. >>> ChessBoardSerializer()
ChessBoardSerializer():
board = ListField(
child=ListField(
child=CharField(allow_blank=True, allow_null=True, label='Board', max_length=10, required=False),
label='Board',
validators=[<django.contrib.postgres.validators.ArrayMaxLengthValidator object>]
),
validators=[<django.contrib.postgres.validators.ArrayMaxLengthValidator object>]
) Does that look good? |
Stellar! 🌟 |
Support for Django 1.8 ArrayField
Add
models.ArrayField
in Django 1.8 toserializers.ListField
mapping by default when using aModelSerializer
.