Give example project models unicode methods

This commit is contained in:
Audrey Roy 2013-05-18 13:44:00 +02:00
parent 6d59986241
commit 52368d9ee1

View file

@ -4,6 +4,12 @@ class Post(models.Model):
title = models.CharField(max_length=255)
body = models.TextField()
def __unicode__(self):
return self.title
class Comment(models.Model):
post = models.ForeignKey(Post)
body = models.TextField()
def __unicode__(self):
return self.body