Conversation
Use Django's timezone-aware clock when filtering outstanding tokens so token list requests do not emit naive datetime warnings under USE_TZ. Refs HumanSignal#9716
👷 Deploy request for heartex-docs pending review.Visit the deploys page to approve it
|
👷 Deploy request for label-studio-docs-new-theme pending review.Visit the deploys page to approve it
|
✅ Deploy Preview for label-studio-storybook canceled.
|
✅ Deploy Preview for label-studio-playground canceled.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes #9716.
Token listing filtered Django
DateTimeFields with naivedatetime.now()values while timezone support is enabled. An authenticatedGET /api/token/consequently emitted twoRuntimeWarnings.Use Django's timezone-aware clock for both expiry filters. The behavior and response shape are otherwise unchanged.
Tests
DJANGO_DB=sqlite uv run --frozen --group test pytest label_studio/tests/jwt_auth/test_views.py -q— 8 passedDJANGO_DB=sqlite uv run --frozen --group test pytest label_studio/tests/jwt_auth -q— 26 passeduv run --frozen --group test pre-commit run --hook-stage pre-push --files label_studio/jwt_auth/views.py label_studio/tests/jwt_auth/test_views.py— Ruff lint and format passedAcceptance criterion: when an authenticated user lists API tokens with timezone support enabled, the endpoint returns 200 without a naive-datetime warning.
Risk is low: only the source of the current timestamp changes, from server-local naive time to Django's configured timezone-aware time.