From d3028e35a9bc62ef79a6924a9858d7d39c7ff829 Mon Sep 17 00:00:00 2001 From: Amos Vryhof Date: Thu, 23 Jan 2020 14:49:07 -0500 Subject: [PATCH] DO_NOTHING on ForeignKey --- djangocms_forms/models.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/djangocms_forms/models.py b/djangocms_forms/models.py index 87dca81..ae48a51 100644 --- a/djangocms_forms/models.py +++ b/djangocms_forms/models.py @@ -4,13 +4,13 @@ import re +from cms.models import CMSPlugin +from cms.models.fields import PageField from django.db import models +from django.db.models import DO_NOTHING from django.template.defaultfilters import slugify from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ - -from cms.models import CMSPlugin -from cms.models.fields import PageField from jsonfield import JSONField from unidecode import unidecode @@ -245,7 +245,9 @@ class FormSubmission(models.Model): Form, verbose_name=_("Form"), editable=False, related_name="submissions", on_delete=models.CASCADE ) creation_date = models.DateTimeField(_("Date"), auto_now=True) - created_by = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_("User"), editable=False, null=True) + created_by = models.ForeignKey( + settings.AUTH_USER_MODEL, verbose_name=_("User"), editable=False, null=True, on_delete=DO_NOTHING + ) ip = models.GenericIPAddressField(verbose_name="IP", blank=True, null=True) referrer = models.CharField(_("Referrer URL"), max_length=150, blank=True)