In the example below, I have a model Proof which contains a foreign key to the model Option.
I want to list all the options in my template along with their respective proofs. How would I go about making the relevant joins in django? I tried using a _set.all() method but that doesn’t seem to work on a queryset, only on a single listing.
Thanks for your help 🙂
Models.py
class Option(TimeStampActivate):
title = models.CharField(max_length=500,null=True)
user = models.ForeignKey(User)
option = models.CharField(max_length=300)
class Proof(TimeStampActivate):
user = models.ForeignKey(User)
option = models.ForeignKey(Option)
comment = models.CharField(max_length=500,null=True)
link = models.URLField()
View.py
options = Option.objects.all()
I think this was supposed to work in template with
options = Option.objects.all()in view().