File tree 1 file changed +6
-7
lines changed
oauth2_provider/migrations
1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1
1
from django .db import migrations
2
- from django .contrib .auth .hashers import identify_hasher , make_password
3
- import logging
4
2
import oauth2_provider .generators
5
3
import oauth2_provider .models
6
-
4
+ from oauth2_provider . settings import oauth2_settings
7
5
8
6
def forwards_func (apps , schema_editor ):
9
7
"""
10
8
Forward migration touches every application.client_secret which will cause it to be hashed if not already the case.
11
9
"""
12
- Application = apps .get_model ('oauth2_provider' , 'application' )
13
- applications = Application .objects .all ()
14
- for application in applications :
15
- application .save (update_fields = ['client_secret' ])
10
+ if oauth2_settings .APPLICATION_MODEL == 'oauth2_provider.Application' :
11
+ Application = apps .get_model ('oauth2_provider' , 'application' )
12
+ applications = Application .objects .all ()
13
+ for application in applications :
14
+ application .save (update_fields = ['client_secret' ])
16
15
17
16
18
17
class Migration (migrations .Migration ):
You can’t perform that action at this time.
0 commit comments