Skip to content

Conversation

@stuartmaxwell
Copy link
Owner

Fixes #151

  • Add a simple search method on the Post model
  • Search can be extended via a plugin
  • Updated the example plugin to show a basic implementation
  • Add template tags for search functionality
  • Update tests
  • Update docs

Register SEARCH_CONTENT hook and implement simple_search to return posts
whose title contains the query, ordered by updated_at. Import Post at
module level and replace the TYPE_CHECKING Post alias with
django.db.models for typing
Include plugin-logic to enable the search method to be swapped out.
- search_title returns the page title for search results
- search_url returns the URL used for searching
- search_form renders a search form
- search_errors renders some HTML that displays errors with the search
  query
Includes logic to dispatch the search view
Also remove noisy debug logs from the search flow
Use unittest.mock.patch to simulate registry.run_hook returning None or
a QuerySet
@stuartmaxwell stuartmaxwell self-assigned this Nov 7, 2025
@stuartmaxwell stuartmaxwell merged commit cfe3c47 into main Nov 7, 2025
6 checks passed
@github-project-automation github-project-automation bot moved this to Done in DJ Press Nov 7, 2025
@stuartmaxwell stuartmaxwell deleted the search_interface branch November 7, 2025 06:49
@codecov
Copy link

codecov bot commented Nov 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/djpress/__init__.py 100.00% <100.00%> (ø)
src/djpress/app_settings.py 100.00% <ø> (ø)
src/djpress/models/post.py 100.00% <100.00%> (ø)
src/djpress/plugins/handlers.py 100.00% <100.00%> (ø)
src/djpress/plugins/hook_registry.py 100.00% <100.00%> (ø)
src/djpress/plugins/plugin_registry.py 100.00% <ø> (ø)
src/djpress/plugins/protocols.py 100.00% <100.00%> (ø)
src/djpress/templatetags/djpress_tags.py 100.00% <100.00%> (ø)
src/djpress/url_utils.py 100.00% <100.00%> (ø)
src/djpress/utils.py 100.00% <100.00%> (ø)
... and 1 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add a search interface

2 participants