diff --git a/post_office/migrations/0012_alter_email_status.py b/post_office/migrations/0012_alter_email_status.py new file mode 100644 index 00000000..0a8dda0c --- /dev/null +++ b/post_office/migrations/0012_alter_email_status.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.13 on 2022-07-22 11:39 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('post_office', '0011_models_help_text'), + ] + + operations = [ + migrations.AlterField( + model_name='email', + name='status', + field=models.PositiveSmallIntegerField(blank=True, choices=[(0, 'sent'), (1, 'failed'), (2, 'queued'), (3, 'requeued'), (4, 'draft')], db_index=True, null=True, verbose_name='Status'), + ), + ] diff --git a/post_office/models.py b/post_office/models.py index d736d48e..9ab9e94f 100644 --- a/post_office/models.py +++ b/post_office/models.py @@ -25,19 +25,18 @@ PRIORITY = namedtuple('PRIORITY', 'low medium high now')._make(range(4)) -STATUS = namedtuple('STATUS', 'sent failed queued requeued')._make(range(4)) +STATUS = namedtuple('STATUS', 'sent failed queued requeued draft')._make(range(5)) class Email(models.Model): """ A model to hold email information. """ - PRIORITY_CHOICES = [(PRIORITY.low, _("low")), (PRIORITY.medium, _("medium")), (PRIORITY.high, _("high")), (PRIORITY.now, _("now"))] STATUS_CHOICES = [(STATUS.sent, _("sent")), (STATUS.failed, _("failed")), - (STATUS.queued, _("queued")), (STATUS.requeued, _("requeued"))] - + (STATUS.queued, _("queued")), (STATUS.requeued, _("requeued")), (STATUS.draft, _("draft"))] + from_email = models.CharField(_("Email From"), max_length=254, validators=[validate_email_with_name]) to = CommaSeparatedEmailField(_("Email To"))