[Answered ]-Django ModelForm not displayed in template

2👍

Thanks for your help everyone, esp. Ale. Tried to print the form in the shell and got a type error.

The object was being created, but couldn’t be printed (or .as_p() ).

The problem was in the Account model that Allocation and Deduction had a foreign key to:

class Account(models.Model):
    user = models.ForeignKey(User)
    account_type = models.ForeignKey(Account_Type)
    def __unicode__(self):
        return self.account_type

I removed the unicode method and it worked. I guess unicode doesn’t return another model’s unicode method, haha.

👤alex

Leave a comment