35 lines
1.4 KiB
Python
35 lines
1.4 KiB
Python
# Generated by Django 5.2.19 on 2026-11-22 14:02
|
|
|
|
import django.core.validators
|
|
from django.db import migrations, models
|
|
from django.utils import timezone
|
|
|
|
|
|
def start_existing_countdown(apps, schema_editor):
|
|
site = apps.get_model('catalog', 'SiteSettings')
|
|
now = timezone.now()
|
|
site.objects.using(schema_editor.connection.alias).filter(
|
|
pk=1, homepage_countdown_enabled=True, homepage_countdown_at__gt=now,
|
|
).update(homepage_countdown_start_at=now.replace(second=0, microsecond=0))
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('catalog', '0020_page_background'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name='sitesettings',
|
|
name='homepage_countdown_bar_color',
|
|
field=models.CharField(blank=True, default='#4395de', help_text='Choose a color or enter a hex value. Blank uses SLUMP blue.', max_length=7, validators=[django.core.validators.RegexValidator('\\A#[0-9a-fA-F]{6}\\Z', 'Enter a six-digit hex color, such as #4395de.')], verbose_name='Progress bar color'),
|
|
),
|
|
migrations.AddField(
|
|
model_name='sitesettings',
|
|
name='homepage_countdown_start_at',
|
|
field=models.DateTimeField(blank=True, help_text='Chicago time. Leave blank to start when you save an active countdown.', null=True, verbose_name='Progress starts'),
|
|
),
|
|
migrations.RunPython(start_existing_countdown, migrations.RunPython.noop),
|
|
]
|