mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-01-24 08:14:16 +03:00
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).
This commit is contained in:
parent
a543fae180
commit
ed55fbe862
|
@ -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)
|
||||
|
||||
---
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user