﻿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
24940	unhashable type: 'RelatedManager' when deleting a model using django admin that has GenericRelation and related_query_name	Federico Jaramillo Martínez	Markus Holtermann	"Ok, a few things before he report:
 - This is my first Django bug report (hope I do well)
 - Didn't know how else to call the report, a better summary is appreciated.

The problem:
When using django admin to delete an instance of a model that has a GenericRelation with a related_query_name, an ""unhashable type: 'RelatedManager'"" error is thrown.

If the related_query_name is removed, the error disappears.

Example structure:

{{{

...

class ModelA(models.Model):

    """"""Model with GenericForeignKey.""""""

    content_type = models.ForeignKey(ContentType)
    object_id = models.PositiveIntegerField()
    content_object = GenericForeignKey()


class ModelB(models.Model):

    """"""Model with a GenericRelation and related_query_name.""""""

    model_a = GenericRelation(ComponenteContable, related_query_name='model_a')


class ModelC(models.Model):

    """"""Model with a GenericRelation and related_query_name.""""""

    model_c = GenericRelation(ComponenteContable, related_query_name='model_c')


class ModelD(models.Model):

    """"""Model with a GenericRelation and related_query_name.""""""

    model_d = GenericRelation(ComponenteContable, related_query_name='model_d')

...

}}}

It is not possible to delete a model B, C or D instance in django admin if the have a related_query_name.

The moment you remove related_query_name, that Model's instances can be deleted."	Bug	closed	contrib.admin	1.8	Release blocker	fixed		Markus Holtermann	Ready for checkin	1	0	0	0	0	0
