mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-25 11:04:02 +03:00
No need to explictitly set None as default (#7373)
This commit is contained in:
parent
9c9ffb18f4
commit
a40bce50cd
|
@ -75,7 +75,7 @@ We can override `.get_queryset()` to deal with URLs such as `http://example.com/
|
|||
by filtering against a `username` query parameter in the URL.
|
||||
"""
|
||||
queryset = Purchase.objects.all()
|
||||
username = self.request.query_params.get('username', None)
|
||||
username = self.request.query_params.get('username')
|
||||
if username is not None:
|
||||
queryset = queryset.filter(purchaser__username=username)
|
||||
return queryset
|
||||
|
|
Loading…
Reference in New Issue
Block a user