1
content_groups
is a dictionary, when you iterate it over via:
for content_group in content_groups:
content_group
would correspond to each key – a ContentGroup
instance. And, you get an error when you try to loop over it – a Django model instance is not iterable.
Instead, you meant to iterate over dictionary items:
for content_group, faq_objects in content_groups.items():
print(content_group)
for faq_object in faq_objects:
print(faq_object)
print("----")
Source:stackexchange.com