﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28141	When have null=True inside ForeignKey, Django don't to do CASCADE Operation even passing on_delete=models.CASCADE. [using PostgreSQL]	mateuspadua	nobody	"Example:

from cms.models import Page


class OfferingPlugin(CMSPlugin):
    image = VersatileImageField(upload_to=unique_upload, ppoi_field='ppoi')
    ppoi = PPOIField()
    title = models.CharField(max_length=50)
    subtitle = models.CharField(max_length=140)
    link_copy = models.CharField(max_length=20)
    link_address = models.ForeignKey(Page, blank=True, null=True, on_delete=models.CASCADE) ** -> dont work because has null=True**

....

page = Page.objecs.first()

If I to try delete a Page instance, for example page.delete() the error bellow will occur: 

.....

IntegrityError: insert or update on table ""offering_offeringplugin"" violates foreign key constraint ""offering_offering_cmsplugin_ptr_id_9a9e9998_fk_cms_cmsplugin_id""
DETAIL:  Key (id)=(10) is still referenced from table ""offering_offeringplugin"".
"	Uncategorized	new	Database layer (models, ORM)	1.10	Normal		ForeignKey null True PostgreSQL	mateuspaduaweb@…	Unreviewed	0	0	0	0	0	0
