Im new in django and I made an Idea list with options just like polls but whenever I wanted to make sure that Ideas with no option is not displayed on index page I couldnt found any way to get the primary key of Ideas to check is there any option for it or not I need all these to make a test for it here is how I get option_set of an specific Idea:
idea = Idea.ojects.get(pk='primary key of idea')
idea.option_set.all()
moreover the Idea list has been filterd by their date and only with past date is displaying as below:
Idea.objects.filter(date__lte=timezone.now())
I tryed for loop as:
for obj in Idea.objects:
if obj.option_set:
****
but the error was:
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'Manager' object is not iterable
also I tryed nested loop but that wasnt the way
as I mentioned at first Im a bigenner so if there is any free tutorial better than django-docs https://www.djangoproject.com/start/ I'll be verry happy to know about.