From ac478979ba24e1c8545950c26394f8c7e7917d04 Mon Sep 17 00:00:00 2001 From: Yuekui Date: Wed, 10 Jun 2020 11:22:27 -0700 Subject: [PATCH] No need to explictitly set None as default --- docs/api-guide/filtering.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/api-guide/filtering.md b/docs/api-guide/filtering.md index 8e3bd9ef5..90cb2ce5a 100644 --- a/docs/api-guide/filtering.md +++ b/docs/api-guide/filtering.md @@ -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 @@ -365,4 +365,4 @@ The [djangorestframework-word-filter][django-rest-framework-word-search-filter] [django-url-filter]: https://github.com/miki725/django-url-filter [drf-url-filter]: https://github.com/manjitkumar/drf-url-filters [HStoreField]: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#hstorefield -[JSONField]: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#jsonfield \ No newline at end of file +[JSONField]: https://docs.djangoproject.com/en/3.0/ref/contrib/postgres/fields/#jsonfield