So, there is an article API containing different parameters including documents model parameter.
Documents model is connected to article model using many to many field.
The current data that is coming is this:
[
{
"id": 2,
"headline": "Article 2",
"abstract": "Abstract 2",
"content": "Content 2",
"published": "2022-08-10T11:28:04.351030Z",
"status": true,
"get_tags": [
{
"id": 1,
"tag": "Python"
},
{
"id": 2,
"tag": "Django Rest Framework"
}
],
"file_documents": [
{
"id": 2,
"document": "http://127.0.0.1:8000/images/tags-Many_RMVHBid.png"
}
],
"created_by": "dummyTest"
}
]
Now here what I want to ask is:
"file_documents": [
{
1
}
If send instead a primarykey instead of whole documents like above. will the data can still be fetched at the frontend and also which one is better this method or the one above this?