Skip to content

Commit

Permalink
Merge pull request #1 from Unholster/fix/response-type-migration
Browse files Browse the repository at this point in the history
Fix/response type migration
  • Loading branch information
sgalvezortiz authored Oct 29, 2020
2 parents f0daed0 + ca9eedf commit b945095
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ def migrate_response_type(apps, schema_editor):
# importing directly yields the latest without response_type
ResponseType = apps.get_model('oidc_provider', 'ResponseType')
Client = apps.get_model('oidc_provider', 'Client')
db = schema_editor.connection.alias
for value, description in RESPONSE_TYPES:
ResponseType.objects.create(value=value, description=description)
for client in Client.objects.all():
client.response_types.add(ResponseType.objects.get(value=client.response_type))
ResponseType.objects.using(db).create(value=value, description=description)
for client in Client.objects.using(db).all():
client.response_types.add(ResponseType.objects.using(db).get(value=client.response_type))


class Migration(migrations.Migration):
Expand Down

0 comments on commit b945095

Please sign in to comment.