在模型有一個多對多的領域,查詢許多人在Django許多領域
從emp.models導入名稱
def info(request):
name = models.ManyToManyField(Name)
而且在emp.models架構是
class Name(models.Model):
name = models.CharField(max_length=512)
def __unicode__(self):
return self.name
現在,當我想查詢一個特定的ID爲前說:
info= info.objects.filter(id=a)
for i in info:
logging.debug(i.name) //gives an error
應該如何查詢是得到名字
謝謝..