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

Update for DRF 3.0 #16

Merged
merged 4 commits into from
Dec 15, 2014
Merged

Update for DRF 3.0 #16

merged 4 commits into from
Dec 15, 2014

Conversation

carltongibson
Copy link

@carltongibson
Copy link
Author

@tomchristie — This is almost working.

I have one issue with the IsOwnerOrReadOnly permission, which isn't immediately obvious to me: requesting the /snippets/ endpoint is resulting in a 500...

 AttributeError: 'Page' object has no attribute 'owner'

i.e. the permission class is not returning before the individual object check. In snippets/permissions.py I've assigned method = request.method which is 'POST' in the debugger. This doesn't make sense to me yet. If something occurs to you do say, otherwise I'll step through it more carefully later on.

Beyond that I just need to go over and remove any bits of old cruft. If anything jumps out to you let me know.

@tomchristie
Copy link
Member

AttributeError: 'Page' object has no attribute 'owner'

Updating to 3.0.1 will resovle this.

@tomchristie
Copy link
Member

(see encode/django-rest-framework#2205)

@carltongibson
Copy link
Author

Ah, that does fix it. :)

(Still not sure why request.method was reporting 'POST' there but that can wait for another day.)

Just pending your comments, if you have any.

@@ -13,3 +13,4 @@ def has_object_permission(self, request, view, obj):

# Write permissions are only allowed to the owner of the snippet
return obj.owner == request.user

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the whitespace (just include the final newline)

@tomchristie
Copy link
Member

Coupla minor things, otherwise ready to go.

@carltongibson
Copy link
Author

Updated

@tomchristie
Copy link
Member

Wonderful! :)

tomchristie added a commit that referenced this pull request Dec 15, 2014
@tomchristie tomchristie merged commit 3e11f7a into encode:master Dec 15, 2014
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.

Update the tutorial repo for 3.0
2 participants