bmihelac / ra-data-django-rest-framework

react-admin data provider for Django REST framework
MIT License
103 stars 30 forks source link

data provider error #14

Closed tombohub closed 3 years ago

tombohub commented 3 years ago

My code is like this: ` import drfProvider from "ra-data-django-rest-framework";

const dataProvider = drfProvider("http://localhost:8000"); `

But, I get this error:

The response to 'getList' must be like { data : [{ id: 123, ...}, ...] }, but the received data items do not have an 'id' key. The dataProvider is probably wrong for 'getList' console.<computed> @ 0.chunk.js:167134

What am I doing wrong?

EDIT: need to include id in serializer fields:

class SaleSerializer(serializers.HyperlinkedModelSerializer): class Meta: model = Sale fields = ['id', 'date', ...]