many to many - How to get Class Model name from ManyToManyField in Django -


i need class model name #django.db.models.fields.related.manytomanyfield object.for example:

class source(models.model):     groups = models.manytomanyfield(group)      def generated_sql(self):         print [f.name f in self._meta.many_to_many]          #tehere need class model name f, in case be: group 

thanks in advance

groups = models.manytomanyfield(group)  def generated_sql(self):     print [(f.name, f.related.parent_model) f in self._meta.many_to_many] 

ipython ftw


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -