Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the draft status to the Email model #407

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions post_office/migrations/0012_alter_email_status.py
Original file line number Diff line number Diff line change
@@ -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'),
),
]
7 changes: 3 additions & 4 deletions post_office/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down