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 4306,'to_field' breaks lookups that span relationships,shwag,nobody,"{{{ #!python class Website(models.Model): id = models.IntegerField(primary_key=True) dfp_id = models.IntegerField() name = models.CharField(maxlength=300) url = models.CharField(maxlength=150) class Report(models.Model): id = models.IntegerField(primary_key=True) site = models.ForeignKey(Website, to_field='dfp_id') }}} 444549 is a valid dfp_id in the Website model. {{{ Report.objects.filter(site=444549) <-- Returns results. good. Report.objects.filter(site__id=444549) <-- Returns results, but it shouldn't. Report.objects.filter(site__dfp_id=444549) <-- No results, but it should. }}} 130 is the valid id for a Website. {{{ Report.objects.filter(site__id=130) <- No results, no work around. Report.objects.filter(site__name='Validname') <- Also no results. Report.objects.filter(site__url='validurl.com') <- Also no results }}}",,closed,"Database layer (models, ORM)",dev,,fixed,qs-rf-fixed,,Accepted,0,0,0,0,0,0