Not sure what I'm doing wrong, but I'd really love to get this fixed after following the README pretty exact I think.
serializers.py
from rest_flex_fields import FlexFieldsModelSerializer
class CastleSerializer(FlexFieldsModelSerializer):
class Meta:
model = Castle
fields = '__all__'
class RoomSerializer(FlexFieldsModelSerializer):
castle = serializers.PrimaryKeyRelatedField(read_only=True)
class Meta:
model = Room
fields = ('id', 'name', 'castle')
expandable_fields = {
"castle": CastleSerializer
}
settings.py
# To make our nested serializers more like JSON API
REST_FLEX_FIELDS = {"EXPAND_PARAM": "include"}
API call: GET /api/v1/room/1/?include=castle
or
API call: GET /api/v1/rooms/?include=castle
I also expect to be able to POST an update method without having to add the nested castle id and have it just validate and work. That looks like it's fixed in the latest.
API call: POST /api/v1/rooms-update/
Not sure what I'm doing wrong, but I'd really love to get this fixed after following the README pretty exact I think.
serializers.py
settings.py
API call:
GET /api/v1/room/1/?include=castle
or API call:GET /api/v1/rooms/?include=castle
both give:
I expect it to be:
I also expect to be able to POST an update method without having to add the nested
castle
id and have it just validate and work. That looks like it's fixed in the latest. API call:POST /api/v1/rooms-update/
It seems none of this is currently working. What am I missing out there (probably obvious to everyone else) to get this library working?