Skip to content

Commit ca04c37

Browse files
Run hasher migration on swapped models
1 parent f76b0f5 commit ca04c37

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
@@ -44,6 +44,7 @@ Jerome Leclanche
4444
Jim Graham
4545
Jonas Nygaard Pedersen
4646
Jonathan Steffan
47+
Joseph Abrahams
4748
Jozef Knaperek
4849
Julien Palard
4950
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)