How to use ArrayField
with a custom field as a child?
#8798
Unanswered
rijenkii
asked this question in
Question & Answer
Replies: 1 comment 1 reply
-
Sounds like you need to be using a serializer field, not a Django model field. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a model with a
field = ArrayField(CustomField())
.I have replaced the
CustomField
with a copy ofUUIDField
from Djangos source code for this example.models.py
urls.py
When adding a new
Test
object, or retrieving an existing one, this error is thrown:Exception
What am I doing wrong?
EDIT:
Exception disappears when I add this to the serializer:
But it doesn't feel right, and does not throw 400 validation errors anymore -- just straight up 500s.
Just in case, I am using that
CustomField
in the project already with no problems.EDIT 2:
Oh, and just in case again, versions:
Beta Was this translation helpful? Give feedback.
All reactions