2017-08-18 21:25:17 -04:00
|
|
|
from django.db import models
|
|
|
|
from django.contrib.auth.admin import User
|
2017-09-14 11:52:49 -04:00
|
|
|
from django.utils import timezone
|
2017-08-18 21:25:17 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Newsletter(models.Model):
|
2017-09-04 12:01:57 -04:00
|
|
|
body = models.TextField()
|
2017-08-18 21:25:17 -04:00
|
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
|
|
creator = models.ForeignKey(User)
|
2017-09-14 11:52:49 -04:00
|
|
|
publish = models.DateTimeField(default=timezone.now)
|
2017-09-03 18:06:59 -04:00
|
|
|
sent = models.BooleanField(default=False)
|
2017-08-18 21:25:17 -04:00
|
|
|
subject = models.CharField(max_length=255)
|
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.subject
|
|
|
|
|
|
|
|
|
2017-08-18 23:23:03 -04:00
|
|
|
class Subscriber(models.Model):
|
2017-09-04 01:16:49 -04:00
|
|
|
email = models.EmailField(unique=True)
|
2017-08-18 23:23:03 -04:00
|
|
|
|
|
|
|
def __str__(self):
|
|
|
|
return self.email
|