Skip to content

Commit

Permalink
Session 10 - you searched for text in CBV
Browse files Browse the repository at this point in the history
  • Loading branch information
wsot committed Aug 18, 2022
1 parent aa03a18 commit 8fb5d86
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/community_db/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ def get_queryset(self):
# Return the queryset now that we have filtered it (if we need to)
return queryset

def get_context_data(self, **kwargs):
# Get the default context that would be generated
context = super().get_context_data(**kwargs)

# Get the search text and add it to the context
search_text = self.request.GET.get("search")
context["search_text"] = search_text

# Return our new context
return context


class PersonDetailView(DetailView):
model = Person
Expand Down

0 comments on commit 8fb5d86

Please sign in to comment.