openwisp-users
openwisp-users copied to clipboard
[feature] MultitenantAdminMixin: filter by the organization of the object if obejct exists
We may be able to restrict the queryset of fields which relate to other models so that only objects that relate to the organization of the parent are shown.
We have to be careful in handling different cases:
- Normal django admin change/add pages (new objects don't have any org set so it can't be done)
- Inlines (maybe we can implement it here too but we should provide a way to disable it if needed)
On changing the organization of the object in the change form, the options for the choice field should also get updated. This will require creating an internal API endpoint for django admin.