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 9899 GenericRelation of a childmodel can't be used in lookup miracle2k nobody "{{{ class Feature(models.Model): object_id = models.PositiveIntegerField() content_type = models.ForeignKey(ContentType) content_object = GenericForeignKey() is_public = models.BooleanField() class Base(models.Model): pass class Child(models.Model): features = GenericRelation(Feature) }}} {{{ >>> Child.objects.filter(features__is_public=False).count() : (1054, ""Unknown column 'app_feature.base_ptr_id' in 'where clause'"") }}} The query that is executed: {{{ SELECT COUNT(*) FROM `app_child` INNER JOIN `app_feature` ON (`app_child`.`feed_ptr_id` = `app_feature`.`object_id`) INNER JOIN `app_feature` T4 ON (`app_feature`.`feed_ptr_id` = T4.`id`) WHERE (`app_feature`.`feed_ptr_id` IS NOT NULL AND T4.`content_type_id` = %s ) }}}" New feature closed Database layer (models, ORM) 1.0 Normal fixed ozgurisil@… Accepted 0 0 0 0 0 0