开发者

Foreign Key relation does not populate in Django admin

Using django 1.0.1 on windows xp and postgres database

I have a very strange problem in the Django admin page. Using the model and admin below, the field "balance" does populate with objects from the Balance model. However, it does NOT populate the locationparameter field: the name "locationparameter" does appear, but there is no pull-down menu.

History: the Balance, BalanceMember object is new and I just did a manage.py syncdb. LocationParameter did already exist in the system.

Manually creating a BalanceMember does work:

bm = BalanceMember.objects.create(balance=b, locationparamete开发者_C百科r=lp, type=1, function=1)
bm.save()

Anyone an idea where to look?

models.py:

class BalanceMember(models.Model):
     balance = models.ForeignKey(Balance)
     locationparameter = models.ForeignKey(LocationParameter)
     type = models.IntegerField()
     function = models.IntegerField()

admin.py

admin.site.register(BalanceMember)


try adding: admin.site.register(LocationParameter)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜