Project: show search settings in separate form — add tests and fix view bugs#12844
Draft
Copilot wants to merge 2 commits intoshow-search-settingsfrom
Draft
Project: show search settings in separate form — add tests and fix view bugs#12844Copilot wants to merge 2 commits intoshow-search-settingsfrom
Copilot wants to merge 2 commits intoshow-search-settingsfrom
Conversation
Member
|
@copilot write tests for the ProjectSearchSettingsUpdate view |
- Add TestProjectSearchSettingsUpdate test class covering GET/POST scenarios - Fix missing PrivateViewMixin on ProjectSearchSettingsUpdate (unauthenticated users weren't redirected to login) - Fix get_success_url() using self.object.slug which fails after form.save() sets self.object to AddonsConfig - Add placeholder search_settings_form.html template (following pull_requests_form.html pattern) Co-authored-by: stsewd <4975310+stsewd@users.noreply.github.com>
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] [RTD-11533] Show search settings in separate form
Project: show search settings in separate form — add tests and fix view bugs
Mar 13, 2026
Contributor
Author
Tests for
Two bugs were also fixed while writing the tests: missing |
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.
ProjectSearchSettingsUpdatehad no tests and contained two bugs that were caught while writing them.Bugs fixed
PrivateViewMixin: The view didn't inherit fromPrivateViewMixin, so unauthenticated users were never redirected to login — they'd hitget_object_or_404directly and get a 404 instead of a redirect.get_success_url()crash on POST: Usedself.object.slug, but Django'sModelFormMixin.form_valid()reassignsself.object = form.save()— and since the form saves anAddonsConfiginstance (notProject), this raisedAttributeError: 'AddonsConfig' object has no attribute 'slug'. Fixed to useself.get_project().slug.Tests added
TestProjectSearchSettingsUpdateinreadthedocs/projects/tests/test_views.py:test_get_returns_200_for_admintest_get_returns_404_for_non_admintest_get_redirects_unauthenticated_usertest_post_updates_search_settings— verifiesAddonsConfig.search_enabledandsearch_show_subprojects_filterare persisted and redirects to the form URLtest_post_updates_partial_search_settings— verifies partial field updates work correctlyTemplate
Added a placeholder
projects/search_settings_form.htmlfollowing the same pattern aspull_requests_form.html(real implementation lives in ext-theme).📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.