From 6d739a4b2f08f2ffbdb1b0ed2a01dd76b9b775e2 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 12 Dec 2014 14:06:15 +0100 Subject: Don't erase any creation of this user when it is deleted (refs #2169) * creator is no more a mandatory field * for associated foreign key relation: on_delete set to SET_NULL --- ishtar_common/models.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'ishtar_common/models.py') diff --git a/ishtar_common/models.py b/ishtar_common/models.py index a9e778dd6..e0fd05a03 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -407,10 +407,13 @@ class HistoryError(Exception): class BaseHistorizedItem(models.Model): history_modifier = models.ForeignKey(User, related_name='+', - verbose_name=_(u"Last editor")) + on_delete=models.SET_NULL, + verbose_name=_(u"Last editor"), blank=True, + null=True) history_creator = models.ForeignKey(User, related_name='+', - verbose_name=_(u"Creator"), blank=True, - null=True) + on_delete=models.SET_NULL, + verbose_name=_(u"Creator"), blank=True, + null=True) class Meta: abstract = True -- cgit v1.2.3