Allow correspondents to be deleted without deleting their documents

Fixes #235
This commit is contained in:
Daniel Quinn
2017-07-15 19:06:52 +01:00
parent ede274386b
commit 347986a2b3
6 changed files with 82 additions and 2 deletions

View File

@@ -172,7 +172,12 @@ class Document(models.Model):
TYPES = (TYPE_PDF, TYPE_PNG, TYPE_JPG, TYPE_GIF, TYPE_TIF,)
correspondent = models.ForeignKey(
Correspondent, blank=True, null=True, related_name="documents")
Correspondent,
blank=True,
null=True,
related_name="documents",
on_delete=models.SET_NULL
)
title = models.CharField(max_length=128, blank=True, db_index=True)