-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* updates to use new tethys logo * fix for migration * fixed migration * black formatting fixes * fixed tethys_config test * typo fix in test
- Loading branch information
Showing
5 changed files
with
10,806 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Generated by Django 4.2.14 on 2024-08-20 21:42 | ||
|
||
from django.db import migrations | ||
from django.utils import timezone | ||
from tethys_config.init import ( | ||
initial_settings, | ||
reverse_init, | ||
custom_settings, | ||
reverse_custom, | ||
) | ||
|
||
|
||
def update_brand_image(apps, schema_editor): | ||
""" | ||
Update the brand image setting | ||
""" | ||
Setting = apps.get_model("tethys_config", "Setting") | ||
|
||
# Get the brand image setting | ||
brand_image_setting = Setting.objects.get(name="Brand Image") | ||
|
||
# Update the brand image setting if it's the default | ||
if brand_image_setting.content == "/tethys_portal/images/tethys-logo-25.png": | ||
brand_image_setting.content = ( | ||
"/tethys_portal/images/tethys-on-blue-icon-only.svg" | ||
) | ||
brand_image_setting.date_modified = timezone.now() | ||
brand_image_setting.save() | ||
|
||
|
||
def reverse_update_brand_image(apps, schema_editor): | ||
""" | ||
Reverse the brand image setting update | ||
""" | ||
Setting = apps.get_model("tethys_config", "Setting") | ||
|
||
# Get the brand image setting | ||
brand_image_setting = Setting.objects.get(name="Brand Image") | ||
|
||
# Update the brand image setting if it's the default | ||
if ( | ||
brand_image_setting.content | ||
== "/tethys_portal/images/tethys-on-blue-icon-only.svg" | ||
): | ||
brand_image_setting.content = "/tethys_portal/images/tethys-logo-25.png" | ||
brand_image_setting.date_modified = timezone.now() | ||
brand_image_setting.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("tethys_config", "0001_initial_40"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
update_brand_image, reverse_code=reverse_update_brand_image | ||
), | ||
] |
Oops, something went wrong.