Skip to content

Commit 970e110

Browse files
author
Hameed Gifford
committed
Add the db alias to the operation queryset
1 parent 4e8550e commit 970e110

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

changelog.d/109.bugfix.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add the database alias to the operation queryset so it will run on the specified database

src/rest_framework_jwt/blacklist/migrations/0002_add_token_id.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
def add_token_id_values(apps, schema_editor):
1010
"""Fill in token_id values for existing token records that have a token id
1111
"""
12+
alias = schema_editor.connection.alias
1213
BlacklistedToken = apps.get_model('blacklist', 'BlacklistedToken')
13-
for row in BlacklistedToken.objects.filter(token_id=None):
14+
for row in BlacklistedToken.objects.using(alias).filter(token_id=None):
1415
payload = jwt.decode(row.token, None, options={'verify_signature': False})
1516
token_id = payload.get('orig_jti') or payload.get('jti')
1617
if token_id:

0 commit comments

Comments
 (0)