-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from GeoNode/ISSUE_6
[Fixes #6] Fix uniqueness of UUID
- Loading branch information
Showing
2 changed files
with
19 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from django.db import migrations | ||
import uuid | ||
|
||
def gen_uuid(apps, schema_editor): | ||
MyModel = apps.get_model('oauth2_provider', 'idtoken') | ||
for row in MyModel.objects.all(): | ||
row.jti = uuid.uuid4() | ||
row.save(update_fields=['jti']) | ||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('oauth2_provider', '0014_auto_20210510_0935'), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(gen_uuid, reverse_code=migrations.RunPython.noop), | ||
] |