Add text search to the My Entries page - #20
Merged
Merged
Conversation
Add a simple search box to the user's My Entries list that filters their own entries by title, description, or tag name. The search is a GET filter, so it composes with the existing project filter and survives pagination. Includes Search and Clear buttons and an updated empty state. Closes #18 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a simple text search on the “My Entries” list so users can filter their own entries using a q query parameter (including matches on title, description, and tag name), addressing issue #18.
Changes:
- Extend
EntryListView.get_queryset()to apply aqfilter across title/description/tag name withdistinct()to avoid duplicates. - Add a search input plus Search/Clear UI, and preserve
qthrough pagination. - Add new tests covering title/description/tag matching, own-entry scoping, empty-state messaging, and deduplication.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tests/test_entries.py | Adds search-focused list view tests (matching, scoping, empty state, no duplicates). |
| apps/entries/views.py | Implements the q filter in the list queryset and exposes search_query to the template. |
| apps/entries/templates/entries/list.html | Adds search form controls, preserves query params during pagination, and updates empty state/CTAs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+18
to
+21
| <label class="block text-xs font-medium text-slate-500 mb-1">Search</label> | ||
| <input type="text" name="q" value="{{ search_query }}" | ||
| placeholder="Title, description, or tag…" | ||
| class="w-full sm:w-64 rounded-md border border-slate-300 px-3 py-1.5 text-sm focus:border-scd-primary focus:ring-1 focus:ring-scd-primary focus:outline-none"> |
Comment on lines
+115
to
+121
| {% if search_query or selected_project %}No entries match your search.{% else %}No entries yet.{% endif %} | ||
| </p> | ||
| {% if search_query or selected_project %} | ||
| <a href="{% url 'entries:list' %}" | ||
| class="inline-block bg-slate-100 hover:bg-slate-200 text-slate-700 text-sm font-medium px-4 py-2 rounded-md transition-colors"> | ||
| Clear search | ||
| </a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a simple text search to the My Entries page, addressing #18.
Changes
EntryListView.get_querysetapplies aqfilter across the user's own entries by title, description, or tag name (Q(title__icontains) | Q(description__icontains) | Q(tags__name__icontains), with.distinct()so multi-tag matches aren't duplicated).entries/list.htmlgains a search input plus Search and Clear buttons;qis preserved through pagination and the empty state is updated.tests/test_entries.py(title/description/tag matching, own-entries scoping, no-match empty state, no duplicate rows).Notes
GETfilter applied on top of the existingauthor=request.userqueryset, so it can only ever surface the requesting user's own entries, and it composes with the existing project filter.Closes #18
🤖 Generated with Claude Code