12👍
✅
If I am understanding correctly, the issue is that you do not see the id
field inside of validated_data
. If so, I believe this is intentional in the framework:
https://github.com/encode/django-rest-framework/issues/2320
Basically, the id
field is read_only
by default. Let me know if you have questions that are not answered by Tom’s response to that issue.
EDIT: Also feel free to share the higher level use case (what you are planning on doing with the ID inside of validation), and maybe we can offer alternative approaches.
Source:stackexchange.com