Well consider two models:
class School(models.Model):
name = models.TextField(default="hello world")
class Student(models.Model):
key = models.TextField(default="somedata")
a = models.ForeignKey(Vendor)
So a many to one relationship from School to Student
How would I get (from School’s perspective) all School which have a Student that set “key” to the required value?
Especially in the already existing query:
School.objects.filter(Q(name="hello world") | Q(queryshould_here))
I’ve tried
A.objects.filter(Q(name="hello world") | Q(student__key="test"))
However that (obviously) fails with:
django.core.exceptions.FieldError: Unsupported lookup 'v' for ManyToOneRel or join on the field not permitted.