Accessing values stored in many-to-many field
===

Trying to figure out why calling each.category_id.all() below is not working. Basically it is not finding any category_ids, yet that table is populated.

I have the following models/relationships:

    class GlobalParts (Models.model):
    ...
    category_id=models.ManyToManyField(Category, related_name = 'globalpart')
    ...

and

    class Category (Model.model):
    ...
    category = models.CharField(max_length=250)
    ...

Script:

    def addcatsfromlist(self):
    		globalparts = GlobalPart.objects.all()
    		for each in globalparts:
    			for catid in each.category_id.all():
    				print catid