mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 12:11:13 -05:00
code optimization for python 3.9+
This commit is contained in:
@@ -93,9 +93,8 @@ class SearchView(TemplateView):
|
|||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
context = super().get_context_data(**kwargs)
|
context = super().get_context_data(**kwargs)
|
||||||
query = self.request.GET.get('q', '').strip()
|
|
||||||
|
|
||||||
if query:
|
if query := self.request.GET.get('q', '').strip():
|
||||||
# Search parks
|
# Search parks
|
||||||
context['parks'] = Park.objects.filter(
|
context['parks'] = Park.objects.filter(
|
||||||
Q(name__icontains=query) |
|
Q(name__icontains=query) |
|
||||||
|
|||||||
Reference in New Issue
Block a user