Skip to content

Commit 0e341c2

Browse files
sanjurojCarlton Gibson
authored andcommitted
Update get_object() example in permissions.md (#5401)
* Update get_object() example in permissions.md I'm a bit confused about the example that's provided in the 'Object level permissions' section. Other examples (e.g. Tutorial 3 - Class Based Views) provided a pk to get_object(). It doesn't seem like this example has any way of identifying a specific object. Just in case I'm correct, I've prepared this pull request. But if I'm wrong, would it be possible for you to explain the example I modified? Many Thanks... * Adjust patch
1 parent 13222e4 commit 0e341c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/api-guide/permissions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ This will either raise a `PermissionDenied` or `NotAuthenticated` exception, or
4444
For example:
4545

4646
def get_object(self):
47-
obj = get_object_or_404(self.get_queryset())
47+
obj = get_object_or_404(self.get_queryset(), pk=self.kwargs["pk"])
4848
self.check_object_permissions(self.request, obj)
4949
return obj
5050

0 commit comments

Comments
 (0)