Added delete triggers to foreign keys

This commit is contained in:
2018-05-24 16:11:59 -04:00
parent eaae3c346d
commit b4991f6782
5 changed files with 11 additions and 11 deletions

View File

@ -18,11 +18,11 @@ class Attachment(models.Model):
class Newsletter(models.Model):
body = HTMLField()
created = models.DateTimeField(auto_now_add=True)
creator = models.ForeignKey(User)
creator = models.ForeignKey(User, on_delete=models.DO_NOTHING)
publish = models.DateTimeField(default=timezone.now)
sent = models.BooleanField(default=False)
subject = models.CharField(max_length=255)
attachments = models.ManyToManyField(Attachment)
attachments = models.ManyToManyField(Attachment, blank=True, null=True)
def __str__(self):
return self.subject