Skip to content

Commit d2c13f0

Browse files
josephabrahamsn2ygk
authored andcommitted
Run hasher migration on swapped models
1 parent 307d07d commit d2c13f0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Jesse Gibbs
4545
Jim Graham
4646
Jonas Nygaard Pedersen
4747
Jonathan Steffan
48+
Joseph Abrahams
4849
Jozef Knaperek
4950
Julien Palard
5051
Jun Zhou

oauth2_provider/migrations/0006_alter_application_client_secret.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from django.db import migrations
2-
from django.contrib.auth.hashers import identify_hasher, make_password
3-
import logging
2+
from oauth2_provider import settings
43
import oauth2_provider.generators
54
import oauth2_provider.models
65

@@ -9,8 +8,8 @@ def forwards_func(apps, schema_editor):
98
"""
109
Forward migration touches every application.client_secret which will cause it to be hashed if not already the case.
1110
"""
12-
Application = apps.get_model('oauth2_provider', 'application')
13-
applications = Application.objects.all()
11+
Application = apps.get_model(settings.APPLICATION_MODEL)
12+
applications = Application._default_manager.all()
1413
for application in applications:
1514
application.save(update_fields=['client_secret'])
1615

0 commit comments

Comments
 (0)