Skip to content

Fix dependent fields in a formset #316

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

Merged
merged 4 commits into from
Mar 15, 2025

Conversation

mardukbp
Copy link

This PR provides a general solution for #136 based on the solution by @rez0n.

The contributions of this solution are the following:

  • Find the closest common ancestor of two chained selects instead of assuming it is a form.
  • Try to find the dependent field by its name attribute using a two-fold search strategy: exact match otherwise ends with

…assuming it is a form.

- Try to find the dependent field by its name attribute using a two-fold search strategy: exact match otherwise ends with
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.19%. Comparing base (f61b09c) to head (a59d972).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #316      +/-   ##
==========================================
- Coverage   98.21%   98.19%   -0.02%     
==========================================
  Files           7        7              
  Lines         280      277       -3     
==========================================
- Hits          275      272       -3     
  Misses          5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Owner

@codingjoe codingjoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't hesitate to use template literals. You may use everything included in Baseline 2024 ;)

@mardukbp
Copy link
Author

I know string literals, but feared breaking django-select2 for someone with an old browser. But if you say it's fine :)

…g the wrong field. Field names in inline forms end with -field_name.
@codingjoe codingjoe merged commit f781527 into codingjoe:main Mar 15, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants