0

結果の追加中(外部キーの追加)はキーエラーを引き起こします

models.py

class table1
    id = models.IntegerField( primary key=TRUE)
    ref = models.ForeignKey('table2')

class table2
    name = models.CharField()
    id = models.IntegerField(primaryKey= True)
    address = models.CharField()

ビュー.py

def relation(request)
"""
    some stuff
"""
    query = "query set makes object of table 1"

    result['content'].append([query['ref__address'])

エラーは

Keyerror at /url
ref__address
4

1 に答える 1