fix bug of filter_by_region for models that had no relation to region but has user relation

This commit is contained in:
2025-10-27 12:01:00 +03:30
parent a20c7cf38b
commit 80a70638f1
2 changed files with 15 additions and 4 deletions

View File

@@ -19,6 +19,7 @@ class BaseViewSet(RegionFilterMixin, viewsets.ModelViewSet):
if self.request.method.lower() == 'get' and not self.kwargs.get('pk'):
queryset = self.filter_by_region(queryset, org=True)
print(queryset)
if not user_relation.first().role.type.key == 'ADM':
model_name = queryset.model.__name__.lower()