From 0e341c24b49c1ae8011fd4e99a13e9cb43ea64f5 Mon Sep 17 00:00:00 2001 From: Sanjuro Jogdeo Date: Fri, 8 Sep 2017 09:51:16 -0700 Subject: [PATCH] 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 --- docs/api-guide/permissions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/permissions.md b/docs/api-guide/permissions.md index 548b14438..ef9ce3abd 100644 --- a/docs/api-guide/permissions.md +++ b/docs/api-guide/permissions.md @@ -44,7 +44,7 @@ This will either raise a `PermissionDenied` or `NotAuthenticated` exception, or For example: def get_object(self): - obj = get_object_or_404(self.get_queryset()) + obj = get_object_or_404(self.get_queryset(), pk=self.kwargs["pk"]) self.check_object_permissions(self.request, obj) return obj