2👍
✅
groups = models.ManyToManyField(Group)
def generated_sql(self):
print [(f.name, f.related.parent_model) for f in self._meta.many_to_many]
iPython ftw
Source:stackexchange.com