I have a list of product. I want to get the category(categories) it is associated with. What i have done is :
pro = [] #holds list of all the products
for p in pro:
for procat in p.get_categories():
print(procat)
but it returns with Error:
'ManyRelatedManager' object is not iterable
I got the method from here DJANGO OSCAR
To get an iterable object for the ManyToManyField "categories" as specified in the docs, you can try to call .all() method, e.g.:
for procat in p.get_categories().all():