Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Session 9 to Session 10 #10

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Session 10 - you searched for text in CBV
wsot committed Sep 19, 2022
commit 4a8044623f2fe155bbcf94bf6da46d390d3d3274
11 changes: 11 additions & 0 deletions src/community_db/views.py
Original file line number Diff line number Diff line change
@@ -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