Skip to content
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

Fixes #18585: filtering circuits by location #18641

Conversation

jnovinger
Copy link
Contributor

@jnovinger jnovinger commented Feb 13, 2025

Fixes: #18585 - filtering circuits by location

This also fixes a related issue where selected filter is not shown in the filter form.

Changes:

  • Adds CircuitFilterSet.location_id field to enable filtering with incoming GET params
  • Adds CircuitFilterForm.location_id field to enable filtering from list form
  • Adds location_id to the Location fieldset on CircuitFilterForm

This also fixes a related issue where selected filter is not shown in
the filter form.

Changes:
- Adds `CircuitFilterSet.location_id` field to enable filtering with
  incoming GET params
- Adds `CirciotFilterForm.location_id` field to enable filtering from
  list form
- Adds `location_id` to the Location fieldset on `CircuitFilterForm`
Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

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

Looks good @jnovinger, thanks! One ask: Could you add a simple test for the new filter under CircuitTestCase? You'll just need to create some Location instances under setUpTestData() and assign circuits to them, then essentially replicate the logic from test_site() method for location_id.

@jnovinger
Copy link
Contributor Author

Looks good @jnovinger, thanks! One ask: Could you add a simple test for the new filter under CircuitTestCase? You'll just need to create some Location instances under setUpTestData() and assign circuits to them, then essentially replicate the logic from test_site() method for location_id.

Test added! Thanks for the catch.

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

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

Thanks @jnovinger!

@jeremystretch jeremystretch merged commit 70dddb6 into netbox-community:main Feb 18, 2025
3 checks passed
@jnovinger jnovinger deleted the 18585-filtering-circuits-by-location-not-working branch February 18, 2025 19:40
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.

Filtering circuits by location not working
2 participants