Skip to content

Conversation

@Srinath0916
Copy link
Contributor

Checklist

  • [x ] I have read the OpenWISP Contributing Guidelines.
  • [ x] I have manually tested the changes proposed in this pull request.
  • [ x] I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Closes #1158.

Description of Changes
Added two new query parameters to the Device list API endpoint:

?location= - filters devices by their associated location
?floorplan= - filters devices by their associated floorplan
The filters work through the DeviceLocation relationship. Added test cases for both filters.

Screenshot

Screenshot 2025-12-02 at 12 32 31 PM Screenshot 2025-12-02 at 12 36 53 PM Screenshot 2025-12-02 at 1 46 01 PM Screenshot 2025-12-02 at 1 46 21 PM

@stktyagi
Copy link
Member

stktyagi commented Dec 4, 2025

Hey @Srinath0916 thank you for the PR. Looking at this PR there are some issues that need to be resolved. For starters kindly make sure you read Openwisp Contributing Guidelines as QA checks are failing in the CI build.

Also it looks like the tests are failing because of missing indoor coordinates. Since you are assigning a floorplan in test_filter_devices_by_floorplan, the DeviceLocation model requires the indoor field to be set.

Kindly make sure to run manual tests too before pushing, it would let you know for any inconsistencies.

@Srinath0916
Copy link
Contributor Author

Srinath0916 commented Dec 6, 2025

Hi, thank you for the review,
I've added the required indoor field to both device location creations in the test_filter_devices_by_floorplan test.
Could you please check if this resolves the issue? Let me know if there's anything else that needs to be fixed.

Thank you.

@Srinath0916
Copy link
Contributor Author

Hi, @stktyagi , thank you for the review,

I've added the required indoor field to both device location creations in the test_filter_devices_by_floorplan test.

I can see that 12 out of 13 CI checks have passed successfully. The only failing check is Python 3.9 with Django 4.2.0, which appears to be failing due to a dependency issue.
This seems to be unrelated to my changes since all other Python versions (3.10, 3.11, 3.12, 3.13) are passing. Could you please let me know if this is a known issue or if there's anything I should do on my end?
Looking forward for your feedback on this so i can work on it.
Thank you.

@Srinath0916
Copy link
Contributor Author

Hi @stktyagi , PR #1174 has been merged which drops Python 3.9 support. Could you re-run the checks on this PR? All tests should pass now. Thanks!

@pandafy pandafy moved this from To do (general) to Needs review in OpenWISP Contributor's Board Dec 10, 2025
@Srinath0916 Srinath0916 force-pushed the issues/device-location-floorplan-filter branch from 9dd8f90 to 33185a8 Compare December 10, 2025 10:55
@coveralls
Copy link

Coverage Status

coverage: 98.608% (+0.001%) from 98.607%
when pulling 33185a8 on Srinath0916:issues/device-location-floorplan-filter
into aa2561f on openwisp:master.

@Srinath0916
Copy link
Contributor Author

Srinath0916 commented Dec 10, 2025

Hi @pandafy , @stktyagi , all checks are passing now, This PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs review

Development

Successfully merging this pull request may close these issues.

[feature] REST API: allow filtering devices by location ID and floorplan ID

3 participants