Skip to content
This repository has been archived by the owner on Jun 10, 2024. It is now read-only.

for usage with djangocms-3.6.0 #75

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sarah-github
Copy link

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".

@GrazingScientist
Copy link

This PR should be definitely pulled! Works perfectly and saved me sooooo much time!

@amdemas
Copy link

amdemas commented Jan 8, 2020

@mishbahr Any chance this is going to be pulled in?

@pidou46
Copy link

pidou46 commented Feb 18, 2020

@mishbahr I would aperciate if you could merge this PR, to avoid loosing this usefull feature for django-cms.

@marcosguedes
Copy link

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!

oxytu added a commit to oxytu/djangocms-forms that referenced this pull request Jun 11, 2020
- Based on Branch by @sarah-github
- Incorporated Feedback from @marcosguedes on Pullrequest mishbahr#75
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants