[Fixed]-Object is not iterable when setting generic relation

1👍

A GenericRelation is the reverse side of the relationship. As with a normal ForeignKey, there are potentially many items that link to any particular instance of B.

You’d need to do:

relation = B.objects.get(pk=1)
relation.content = A().save()
relation.save()

Leave a comment