user1836831
user1836831

Reputation: 575

How to display IntegerField in django admin?

How to display IntegerField in django admin?

My error: coercing to Unicode: need string or buffer, int found

class Day(models.Model):
    day = models.IntegerField()

    def __unicode__(self):
        return self.day

Upvotes: 3

Views: 2731

Answers (1)

scytale
scytale

Reputation: 12641

you need to return a string, not an integer. like this:

return str(self.day)

Upvotes: 8

Related Questions