Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get_dataframe() crashes if 'id' is not included in ModelSerializer fields #13

Closed
sheppard opened this issue Apr 21, 2015 · 1 comment
Closed

Comments

@sheppard
Copy link
Member

See http://paste.ubuntu.com/10862242/.

Currently the only way to get around this (short of adding id back to the included fields) is to subclass PandasSerializer and override get_index() to ensure it returns None (or any included field).

A better solution would be to have the default get_index() check for the id field before using it as the index, or to make it return None by default and always require it to be overridden for users that want an index to be set on their DataFrame.

@sheppard sheppard modified the milestone: 1.0 Aug 25, 2016
@jsmedmar
Copy link

I like sheppard solution, another option would be to check for pk as well.

@sheppard sheppard modified the milestones: 1.0, 1.1 Jun 20, 2017
@sheppard sheppard modified the milestones: 1.1, 1.0 Sep 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants