Hello! I've been looking through the docs and I couldn't find how to define a model and datagrid that can use a primary key which is not named "id". For example, we have a Location resource with
code: zipcode, primary key
name: some string
The REST endpoint is still /locations/:code/ and works ok, acting on the code attribute.
Is this possible? Thanks!
From what I know, admin-on-rest requires an id field for each item. It can be integer or string, but it is definitely required. It may be much easier to change backend or your restClient to rename code field into id.
And the tutorial for doing this is online: https://marmelab.com/admin-on-rest/FAQ.html#can-i-have-custom-identifiers-primary-keys-for-my-resources
Thank you!
On 16 May 2017 at 08:56, Francois Zaninotto notifications@github.com
wrote:
And the tutorial for doing this is online: https://marmelab.com/admin-on-
rest/FAQ.html#can-i-have-custom-identifiers-primary-keys-for-my-resources—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/marmelab/admin-on-rest/issues/670#issuecomment-301705193,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAeeLfOiFYOrtpXa7kxvu0qrVW39Ac1Uks5r6VbKgaJpZM4NaLXA
.
Most helpful comment
https://github.com/marmelab/admin-on-rest/issues/373