djangocms-forms
djangocms-forms copied to clipboard
for usage with djangocms-3.6.0
Installed it for djangocms-3.6.0 in my infrastructure and fixed errors. The description concerning including urls might also get updated to use "path" instead of "url".
This PR should be definitely pulled! Works perfectly and saved me sooooo much time!
@mishbahr Any chance this is going to be pulled in?
@mishbahr I would aperciate if you could merge this PR, to avoid loosing this usefull feature for django-cms.
Great work!
I think you could, however, make it better by adding on_delete
on created_by
(thus adding support to Django 2.x) and maintaining consistency with previous on_delete
calls
diff --git a/djangocms_forms/models.py b/djangocms_forms/models.py
index 069f151..973b902 100644
--- a/djangocms_forms/models.py
+++ b/djangocms_forms/models.py
@@ -128,7 +128,7 @@ class FormDefinition(CMSPlugin):
@python_2_unicode_compatible
class FormField(models.Model):
- form = models.ForeignKey(FormDefinition, related_name='fields', on_delete='CASCADE')
+ form = models.ForeignKey(FormDefinition, related_name='fields', on_delete=models.CASCADE)
field_type = models.CharField(
_('Field Type'), max_length=100,
choices=settings.DJANGOCMS_FORMS_FIELD_TYPES,
@@ -223,10 +223,10 @@ class FormField(models.Model):
@python_2_unicode_compatible
class FormSubmission(models.Model):
plugin = models.ForeignKey(
- Form, verbose_name=_('Form'), editable=False, related_name='submissions', on_delete='CASCADE')
+ 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)
+ settings.AUTH_USER_MODEL, verbose_name=_('User'), editable=False, null=True, on_delete=models.SET_NULL)
ip = models.GenericIPAddressField(verbose_name='IP', blank=True, null=True)
referrer = models.CharField(_('Referrer URL'), max_length=150, blank=True)
All the best!