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 4681 filter on foreign keys with None doesn't return anything Patrick Lauber Adrian Holovaty "At the moment you have to do it like this: {{{ class Category(models.Model): name = models.CharField(core=True, maxlength=64) parent = models.ForeignKey('self', blank=True, null=True, related_name='child') def getNavigation(request,parent): if parent==None: return Category.objects.filter(parent__id__isnull=True).order_by('-priority') else: return Category.objects.filter(parent__id=parent).order_by('-priority') }}} I think for a newbie to Databases like me this not very intuitive. Wouldn't it be possible to make the isnull check automatically behind the scenes if the argument is None or an empty String?" closed Database layer (models, ORM) dev wontfix filter foreignkey None Unreviewed 0 0 0 0 0 0