Skip to content

For list view, ensure 'results' in data #59

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

Closed

Conversation

pattisdr
Copy link
Contributor

Purpose

There are instances where a list view is not sending 'results' in data so you get a KeyError in render. An example is when you send an options request on a list resource in the Django Rest Framework. This results in a 'KeyError'.

screen shot 2015-08-14 at 10 28 18 am
screen shot 2015-08-14 at 10 28 30 am

Changes

Ensures list view has 'results' in data

@jsenecal
Copy link
Member

I understand the goal behind this commit but I cant replicate the issue you are having there... Have you tried this against the latest develop?

@pattisdr
Copy link
Contributor Author

Yes, I tried this against the latest develop. With our application, on a list view, requesting options throws a KeyError. I imagine there might be other instances where results aren't in data. This check just ensures results are in data before accessing it.

@jsenecal
Copy link
Member

Strange because my installation does not throw that exception when requesting options

@jsenecal
Copy link
Member

@jerel I dont mind merging this - but I think that data might be malformed if it is missing results in a list view... (I never had any issues with any of the functions of DRF myself) - Let us know

@jerel jerel closed this in 403a4b2 Aug 20, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants