Fix #22671 : Enable multi-selection for Site Groups and other scopes in VLAN Groups filter#22708
Conversation
|
@LujainYasser1 could you please drop a comment on #22671 so the issue can be assigned to you? Thanks. |
… VLANGroupFilterSet
|
@claude /review Only report on issues of potential concern; we don't need commentary on anything that doesn't require further consideration. |
|
Claude finished @pheus's task in 1m 21s —— View job Review
1. Tests don't verify multi-value filteringThe existing scope filter tests ( def test_region(self):
params = {'region': Region.objects.first().pk}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)Since the entire purpose of this PR is to enable multi-value filtering, at minimum each test should also verify that passing a list of IDs returns multiple results (similar to how 2. Redundant
|
pheus
left a comment
There was a problem hiding this comment.
Thanks for opening this PR!
Could you please take a look at Claude's review comments and either address the points it raised or reply with a short explanation where you think a comment doesn’t apply? That context would be really helpful for the review.
Finally, please address the tests and lint failures. Thanks!
Closes: #22671
Description
The filter form for VLAN Groups sends arrays of IDs for site groups and other scopes, but
VLANGroupFilterSetwas implementing them usingNumberFilter. This caused the backend to drop multiple selections or fail to process them properly.I replaced
NumberFilterwithMultiValueNumberFilteracross all scope fields inVLANGroupFilterSet(includingsite_group,region,site,location,rack_group,rack,cluster_group, andcluster). I also refactored thefilter_scopemethod to usescope_id__in=valueso it can cleanly evaluate multiple lookups at once.Checklist