diff --git a/django_forest/tests/resources/views/list/test_list_scope.py b/django_forest/tests/resources/views/list/test_list_scope.py index a46467c..1111aa0 100644 --- a/django_forest/tests/resources/views/list/test_list_scope.py +++ b/django_forest/tests/resources/views/list/test_list_scope.py @@ -26,6 +26,11 @@ 'operator': 'contains', 'value': 'color' }, + { + 'field': 'id', + 'operator': 'greater_than', + 'value': 0 + }, ] }, 'dynamicScopesValues': {} @@ -44,6 +49,11 @@ 'operator': 'contains', 'value': 'color' }, + { + 'field': 'id', + 'operator': 'less_than', + 'value': 0 + }, { 'field': 'question_text', 'operator': 'contains', diff --git a/django_forest/utils/scope.py b/django_forest/utils/scope.py index aacce3a..66d8d0f 100644 --- a/django_forest/utils/scope.py +++ b/django_forest/utils/scope.py @@ -40,7 +40,7 @@ def _format_dynamic_values(user_id, collection_scope): try: scope = collection_scope['scope'] for condition in scope['filter']['conditions']: - if condition['value'].startswith('$currentUser'): + if str(condition['value']).startswith('$currentUser'): condition['value'] = scope['dynamicScopesValues']['users'][user_id][condition['value']] return scope['filter'] except Exception: