I'm trying for a few hour how to get other fields representation in serializer when i'm doing get and other when i'm doing post.
I want this all data which are in author field in json, but lower in html form i want only choose exist user from list. When i change author field to display only url then i can choose author from list.
Is it possible to get author info like on first screen and have only possibility to choose author from user list without editing all user fields?
I think what you need is author as a ForeignKey in You Model.
Something like:
author = models.ForeignKey(
Author,
on_delete=models.CASCADE
)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.