-
Notifications
You must be signed in to change notification settings - Fork 6
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 #104 from maykinmedia/release/2.1.3
Release/2.1.3
- Loading branch information
Showing
16 changed files
with
216 additions
and
19 deletions.
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
16 changes: 16 additions & 0 deletions
16
src/objecttypes/token/migrations/0004_rename_tokenauth_oldtokenauth.py
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,16 @@ | ||
# Generated by Django 4.2.11 on 2024-05-02 12:56 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("token", "0003_auto_20210315_1547"), | ||
] | ||
|
||
operations = [ | ||
migrations.RenameModel( | ||
old_name="TokenAuth", | ||
new_name="OldTokenAuth", | ||
), | ||
] |
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,90 @@ | ||
# Generated by Django 4.2.11 on 2024-05-02 13:01 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("token", "0004_rename_tokenauth_oldtokenauth"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="TokenAuth", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("token", models.CharField(max_length=40, verbose_name="token")), | ||
( | ||
"contact_person", | ||
models.CharField( | ||
help_text="Name of the person in the organization who can access the API", | ||
max_length=200, | ||
verbose_name="contact person", | ||
), | ||
), | ||
( | ||
"email", | ||
models.EmailField( | ||
help_text="Email of the person, who can access the API", | ||
max_length=254, | ||
verbose_name="email", | ||
), | ||
), | ||
( | ||
"organization", | ||
models.CharField( | ||
blank=True, | ||
help_text="Organization which has access to the API", | ||
max_length=200, | ||
verbose_name="organization", | ||
), | ||
), | ||
( | ||
"last_modified", | ||
models.DateTimeField( | ||
auto_now=True, | ||
help_text="Last date when the token was modified", | ||
verbose_name="last modified", | ||
), | ||
), | ||
( | ||
"created", | ||
models.DateTimeField( | ||
auto_now_add=True, | ||
help_text="Date when the token was created", | ||
verbose_name="created", | ||
), | ||
), | ||
( | ||
"application", | ||
models.CharField( | ||
blank=True, | ||
help_text="Application which has access to the API", | ||
max_length=200, | ||
verbose_name="application", | ||
), | ||
), | ||
( | ||
"administration", | ||
models.CharField( | ||
blank=True, | ||
help_text="Administration which has access to the API", | ||
max_length=200, | ||
verbose_name="administration", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "token authorization", | ||
"verbose_name_plural": "token authorizations", | ||
}, | ||
), | ||
] |
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,49 @@ | ||
from django.db import migrations | ||
|
||
|
||
def switch_to_new_token_model(apps, _): | ||
OldTokenAuth = apps.get_model("token", "OldTokenAuth") | ||
TokenAuth = apps.get_model("token", "TokenAuth") | ||
|
||
for old_token in OldTokenAuth.objects.all(): | ||
TokenAuth.objects.get_or_create( | ||
token=old_token.token, | ||
defaults={ | ||
"contact_person": old_token.contact_person, | ||
"email": old_token.email, | ||
"organization": old_token.organization, | ||
"last_modified": old_token.last_modified, | ||
"created": old_token.created, | ||
"application": old_token.application, | ||
"administration": old_token.administration, | ||
}, | ||
) | ||
|
||
|
||
def switch_to_old_token_model(apps, _): | ||
OldTokenAuth = apps.get_model("token", "OldTokenAuth") | ||
TokenAuth = apps.get_model("token", "TokenAuth") | ||
|
||
for token in TokenAuth.objects.all(): | ||
OldTokenAuth.objects.get_or_create( | ||
token=token.token, | ||
defaults={ | ||
"contact_person": token.contact_person, | ||
"email": token.email, | ||
"organization": token.organization, | ||
"last_modified": token.last_modified, | ||
"created": token.created, | ||
"application": token.application, | ||
"administration": token.administration, | ||
}, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("token", "0005_tokenauth"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(switch_to_new_token_model, switch_to_old_token_model), | ||
] |
15 changes: 15 additions & 0 deletions
15
src/objecttypes/token/migrations/0007_delete_oldtokenauth.py
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,15 @@ | ||
# Generated by Django 4.2.11 on 2024-05-02 13:03 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("token", "0006_copy_token_auth"), | ||
] | ||
|
||
operations = [ | ||
migrations.DeleteModel( | ||
name="OldTokenAuth", | ||
), | ||
] |
17 changes: 17 additions & 0 deletions
17
src/objecttypes/token/migrations/0008_alter_tokenauth_token.py
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,17 @@ | ||
# Generated by Django 4.2.11 on 2024-05-02 13:04 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("token", "0007_delete_oldtokenauth"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="tokenauth", | ||
name="token", | ||
field=models.CharField(max_length=40, unique=True, verbose_name="token"), | ||
), | ||
] |
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