我有以下型号:
class App(models.Model):
name = models.CharField(max_length=20)
...
class Request(models.Model):
...
app = models.ForeignKey(App)
...
尝试以下操作时:
a = App.objects.all().prefetch_related('request_set')
for r in a.requests:
print r
它给:
AttributeError: 'QuerySet' object has no attribute 'requests'
这是为什么?