-
Notifications
You must be signed in to change notification settings - Fork 302
Closed
Description
I need to get choices for ResourceRelatedField, when I make OPTIONS request. How to do it?
# serializer:
self.fields['members'] = ResourceRelatedField(
queryset=Profile.objects.filter(is_active=True),
many=True
)
Current output:
"members": {
"type": "Relationship",
"relationship_type": "ManyToMany",
"relationship_resource": "profiles",
"required": false,
"read_only": false,
"write_only": false,
"label": "Members",
"initial": "[]"
},
If I remove this line, (It is what I want) I get desired output:
"members": {
"type": "field",
"required": false,
"read_only": false,
"label": "Members",
"relationship_type": "ManyToMany",
"choices": [
{
"value": "{\"type\": \"profiles\", \"id\": \"1\"}",
"display_name": "Arthur"
},
{
"value": "{\"type\": \"profiles\", \"id\": \"2\"}",
"display_name": "Tom"
}
]
},
Can we remove not field_info.get('relationship_resource') and
from choices condition, or how to generate output that I want (without modifying metadata.py
)?
Metadata
Metadata
Assignees
Labels
No labels