From cf341c19fe9452f0311f2c9d08b584a86dc7038e Mon Sep 17 00:00:00 2001 From: stumpylog <797416+stumpylog@users.noreply.github.com> Date: Wed, 15 Apr 2026 13:59:02 -0700 Subject: [PATCH] fix(tasks): add queryset stub to satisfy drf-spectacular schema generation TasksViewSet.get_queryset() accesses request.user, which drf-spectacular cannot provide during static schema generation. Adding a class-level queryset = PaperlessTask.objects.none() gives spectacular a model to introspect without invoking get_queryset(), eliminating both warnings and the test_valid_schema failure. Co-Authored-By: Claude Sonnet 4.6 --- src/documents/views.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/documents/views.py b/src/documents/views.py index fc1b55acf..4002fb4d6 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -3786,6 +3786,8 @@ class TasksViewSet(ReadOnlyModelViewSet[PaperlessTask]): "wait_time_seconds", ] ordering = ["-date_created"] + # Needed for drf-spectacular schema generation (get_queryset touches request.user) + queryset = PaperlessTask.objects.none() # v9 backwards compat: maps old "type" query param values to new TriggerSource _V9_TYPE_TO_TRIGGER_SOURCE = {