1
根據我的理解,預填充的字段不應包含foriegnkey。我想到了一個解決方法。預填充字段和函數()
在我的模型..我的名字的getName()
def getname(self):
t1 = str(self.team_one)
t2 = str(self.team_two)
t1t2 = t1 + ' vs ' + t2
return t1t2
,把它在我的管理..的思想定義的函數我這是怎麼做的吧。
prepopulated_fields = { 'name': ('getname()',)}
它應該解決我的問題,但這是django說的。
Exception Type: ImproperlyConfigured
Exception Value:
'FixtureAdmin.prepopulated_fields['name'][0]' refers to field 'getname' that is missing from model 'Fixture'.
是有解決它,或者我應該放棄這個想法?
//鼠標
你想要做什麼?也許你可以用jQuery寫自己定製的Javscript? – 2012-03-09 17:13:58
我正在嘗試設置基於兩個球隊的夾具的名稱。 – debuggerpk 2012-03-09 17:31:03