-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: Grouper models must not assume language grouper #8194
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
Conversation
Reviewer's Guide by SourceryThis pull request adds tests for grouper models without a language field, ensuring that the admin interface functions correctly in these cases. It also fixes a validation error that occurred when the language field was not present. No diagrams generated as the changes look simple and do not need a visual representation. File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @fsbraun - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider renaming
SimpleChangeListActionsTestCase
toChangeListActionsTestCase
andChangeListActionsTestCase
toLanguageAwareChangeListActionsTestCase
to better reflect their purpose. - It might be cleaner to use inheritance or mixins to avoid duplicating the setup logic in
SetupMixin
andSimpleSetupMixin
.
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the assumption that all grouper models must have a language field by adding support and tests for simple grouper models without a language grouping field.
- Added new test mixins and test cases for SimpleGrouperModel and SimpleGrouperModelContent.
- Introduced new fields (region, uptodate, secret_greeting) in GrouperModelContent and similar definitions for simple grouper models.
- Updated URL construction in tests and modified validation logic in the admin utilities module to handle models lacking a language field.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
File | Description |
---|---|
cms/tests/test_grouper_admin.py | Added new test classes for simple grouper models; updated URL formatting and checks. |
cms/test_utils/project/sampleapp/models.py | Added new fields and model definitions for handling content groupers without language. |
cms/test_utils/project/sampleapp/admin.py | Introduced SimpleGrouperAdmin to display simple grouper model details in the admin. |
cms/admin/utils.py | Modified language field validation to use get_language_list instead of get_language_dict. |
Comments suppressed due to low confidence (2)
cms/tests/test_grouper_admin.py:30
- [nitpick] The variable 'groupermodel' is defined alongside 'grouper_model', which could be confusing. Consider using a consistent naming convention to clearly differentiate the two or merge them if they serve the same purpose.
self.groupermodel = "groupermodel"
cms/tests/test_grouper_admin.py:347
- [nitpick] There appears to be a duplicate check for the hidden input field for content language. Verify if the extra check is intentional or if it should be removed to avoid redundancy.
self.assertContains(response, '<input type="hidden" name="content__language" value="en" id="id_content__language">',)
* fix: Grouper models w/o language grouper * Keep language field, but not as grouper * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/admin/utils.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Fix ruff issues --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
* fix: Grouper models w/o must not assume language grouper (#8194) * fix: Grouper models w/o language grouper * Keep language field, but not as grouper * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/admin/utils.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update cms/tests/test_grouper_admin.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Fix ruff issues --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Fix ruff linting --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Description
Fixes #8193 Needs to be backported to CMS 4.1
The whole test of the cms.admin.utils module assume the presence of a language field. This PR adds the same tests for a grouper/content model without language as a grouping field.
Related resources
Checklist
main
Summary by Sourcery
Add support for grouper models without a language field in the admin interface
Bug Fixes:
Enhancements:
Tests: