# Generated by Django 2.2.11 on 2021-04-30 09:21

from django.db import migrations, models


def set_message(apps, schema_editor):
    m = apps.get_model("account", "CommunityAuthSite")
    m.objects.filter(cooloff_hours__gt=0) \
             .update(cooloff_message='Please try again later, or contact the postgresql.org webmasters if you have an urgent need to log in.')


def unset_message(apps, schema_editor):
    # We're going to drop the column, so nothing to do
    return


class Migration(migrations.Migration):

    dependencies = [
        ('account', '0007_all_emails_view'),
    ]

    operations = [
        migrations.AddField(
            model_name='communityauthsite',
            name='cooloff_message',
            field=models.TextField(blank=True, help_text='Message (HTML format allowed, will be wrapped in <P>) to show users who have not passed the cool-off period'),
        ),
        migrations.AlterField(
            model_name='communityauthsite',
            name='cooloff_hours',
            field=models.PositiveIntegerField(default=0, help_text='Number of hours a user must have existed in the systems before allowed to log in to this site'),
        ),
        migrations.RunPython(set_message, unset_message),
    ]
