Phase 0: Improve ModuleEnableSettings get_queryset to filter by account

- Updated get_queryset to properly filter by account
- Ensures queryset is account-scoped before list() is called
- Prevents potential conflicts with base class behavior
This commit is contained in:
IGNY8 VPS (Salman)
2025-11-16 19:25:36 +00:00
parent 8fc483251e
commit 0d468ef15a

View File

@@ -309,7 +309,16 @@ class ModuleEnableSettingsViewSet(AccountModelViewSet):
def get_queryset(self):
"""Get module enable settings for current account"""
# Return queryset filtered by account - but list() will handle get_or_create
queryset = super().get_queryset()
# Filter by account if available
account = getattr(self.request, 'account', None)
if not account:
user = getattr(self.request, 'user', None)
if user:
account = getattr(user, 'account', None)
if account:
queryset = queryset.filter(account=account)
return queryset
def list(self, request, *args, **kwargs):