mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-04-16 04:58:53 +00:00
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 <noreply@anthropic.com>
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user