openwisp/openwisp-users

[bug] API mixins don't take into account organization_lookup

nemesifier opened this issue · 3 comments

Some classes in openwisp-users were not taking into account the organization_lookup field, hence queries were failing to find the right organization field, I solved this in https://github.com/openwisp/openwisp-users/tree/improve-api-mixins, but tests are missing, we need at least one test in openwisp-users.

I discovered this while working on openwisp/openwisp-firmware-upgrader#142.

@nemesisdesign I am not able to replicate the issue for which you have made the changes here:- https://github.com/openwisp/openwisp-users/tree/improve-api-mixins, for me organization_field is filtered and working good. Can you please explain a bit more on how can I replicate the issue.
--Thank You

@nemesisdesign I am not able to replicate the issue for which you have made the changes here:- https://github.com/openwisp/openwisp-users/tree/improve-api-mixins, for me organization_field is filtered and working good. Can you please explain a bit more on how can I replicate the issue.
--Thank You

FilterByParent and FilterSerializerByOrganization do not work if the organization field is on a parent model.

Try to use these classes as they are now in the master of openwisp-firmware-upgrader and you'll understand, firmware upgrader has a few models which rely on the organization field of the parent objects.

Yes Got it. 👍