-
Notifications
You must be signed in to change notification settings - Fork 0
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 #622 from UnitapApp/develop
Develop
- Loading branch information
Showing
5 changed files
with
87 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Generated by Django 4.0.4 on 2024-08-25 09:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def fix_raffle_images_prefix(apps, schema): | ||
Raffle = apps.get_model("prizetap", "Raffle") | ||
|
||
raffles = Raffle.objects.all() | ||
|
||
for raffle in raffles: | ||
if ( | ||
raffle.image | ||
and raffle.image.name | ||
and raffle.image.name.startswith("https://imagedelivery.net") | ||
): | ||
# split the url to get the image id | ||
raffle.image.name = raffle.image.name.split("/")[-2] | ||
raffle.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("prizetap", "0078_alter_constraint_name"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
fix_raffle_images_prefix, reverse_code=migrations.RunPython.noop | ||
) | ||
] |
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,40 @@ | ||
# Generated by Django 4.0.4 on 2024-08-25 09:12 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
def fix_token_images_prefix(apps, schema_editor): | ||
TokenDistribution = apps.get_model("tokenTap", "TokenDistribution") | ||
|
||
tokens = TokenDistribution.objects.all() | ||
|
||
for token in tokens: | ||
if ( | ||
token.image | ||
and token.image.name | ||
and token.image.name.startswith("https://imagedelivery.net") | ||
): | ||
# split the url to get the image id | ||
token.image.name = token.image.name.split("/")[-2] | ||
token.save() | ||
|
||
if ( | ||
token.token_image | ||
and token.token_image.name | ||
and token.token_image.name.startswith("https://imagedelivery.net") | ||
): | ||
token.token_image.name = token.token_image.name.split("/")[-2] | ||
token.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("tokenTap", "0064_alter_constraint_name"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
fix_token_images_prefix, reverse_code=migrations.RunPython.noop | ||
) | ||
] |