python - How to query filter in django without multiple occurrences -


I have 2 models:

Parent MODEL: 'Just' sits there

< P> ChildModel: There is a foreign key for parents

ParentModel.objects.filter (childmodel__in = childmodel.objects.all ()) Many of the parents' events gives.

How do I ask all parents models who have at least one child model that is referring to it? And without many incidents ...

You almost got it right ...

  ParentModeel.Obages Filter (childmodel__in = childmodel.object.all ()). Specific ()  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -