Commit ed55fbe8 by Ian Foote

Fix custom HyperlinkedRelatedField example

Fix `get_object` method signature to match [`HyperlinkedRelatedField.get_object`](https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/relations.py#L227-L236).
parent a543fae1
......@@ -498,10 +498,10 @@ For example, if all your object URLs used both a account and a slug in the the U
kwargs = {'account': obj.account, 'slug': obj.slug}
return reverse(view_name, kwargs=kwargs, request=request, format=format)
def get_object(self, queryset, view_name, view_args, view_kwargs):
def get_object(self, view_name, view_args, view_kwargs):
account = view_kwargs['account']
slug = view_kwargs['slug']
return queryset.get(account=account, slug=slug)
return self.get_queryset().get(account=account, slug=slug)
---
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment