[Django]-Django query – Retrieve objects that don't have other object pointing to them

4👍

First condition: language is english

Second condition: not exists another string that references it.

String.objects.filter( language = 'english', 
                       string__original_string__isnull = True )

A foreignkey backward reference is needed.

1👍

Try this

String.objects.filter(language__name="English", original_string__isnull=True)

Leave a comment