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)
精彩评论