﻿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
26585	Cascade-deletion through generic foreign keys ignores field names	Adam Nickle	nobody	"Create three models:

{{{#!python
from django.db import models
from django.contrib.contenttypes import generic


class Location(models.Model):
    address_line1 = models.CharField()

class Account(models.Model):
    acct_number = models.CharField()

class Link(models.Model):
    account = models.ForeignKey(Account)
    linked_object_id = models.PositiveIntegerField()
    linked_object_content_type = models.ForeignKey(ContentType)
    linked_object = generic.GenericForeignKey('linked_object_content_type', 'linked_object_id')
}}}

With this setup, deleting a `Location` object will attempt to cascade-delete any associated `Link` objects. In doing so, Django ignores the parameters to the `GenericForeignKey` field constructor and instead expects the content type to be in a field called `content_type` and the object id in `object_id`. This prevents cascade deletion through generic foreign keys from working whenever these fields aren't named as expected or whenever there are multiple generic foreign keys in a model.
"	Bug	closed	contrib.contenttypes	1.8	Normal	needsinfo	genericforeignkey delete		Unreviewed	0	0	0	0	0	0
