Bulk Email: Add design styling

Switch to using decorators; refactor and cleanup tests.
This commit is contained in:
Sarina Canelake
2013-08-16 12:00:14 -04:00
parent 3b32d4216c
commit 65f7b098dd
12 changed files with 381 additions and 148 deletions

View File

@@ -10,6 +10,7 @@ class Email(models.Model):
Abstract base class for common information for an email.
"""
sender = models.ForeignKey(User, default=1, blank=True, null=True)
# The unique hash for this email. Used to quickly look up an email (see `tasks.py`)
hash = models.CharField(max_length=128, db_index=True)
subject = models.CharField(max_length=128, blank=True)
html_message = models.TextField(null=True, blank=True)
@@ -24,10 +25,20 @@ class CourseEmail(Email, models.Model):
"""
Stores information for an email to a course.
"""
TO_OPTIONS = (('myself', 'Myself'),
('staff', 'Staff and instructors'),
('all', 'All')
)
# Three options for sending that we provide from the instructor dashboard:
# * Myself: This sends an email to the staff member that is composing the email.
#
# * Staff and instructors: This sends an email to anyone in the staff group and
# anyone in the instructor group
#
# * All: This sends an email to anyone enrolled in the course, with any role
# (student, staff, or instructor)
#
TO_OPTIONS = (
('myself', 'Myself'),
('staff', 'Staff and instructors'),
('all', 'All')
)
course_id = models.CharField(max_length=255, db_index=True)
to = models.CharField(max_length=64, choices=TO_OPTIONS, default='myself')