models.py
class A (models.Model ):
name = models.CharField (u'作者')
class B (models.Model ):
author = models.ForeignKey (A )
book = models.CharField (u'书籍')
怎么查询出所有
"A.name,B.book"
这样的数据?
1
IanPeverell 2015-09-09 19:01:28 +08:00
$python manage.py shell
>>>from XXX.models import A,B >>>A.objects.all (),B.objects.all () 不知道你是不是问的是这个… |
2
wenbinwu 2015-09-09 19:09:16 +08:00 1
|