django-admin2/example/blog/models.py

15 lines
332 B
Python
Raw Normal View History

2013-05-18 10:12:57 +00:00
from django.db import models
class Post(models.Model):
title = models.CharField(max_length=255)
body = models.TextField()
def __unicode__(self):
return self.title
2013-05-18 10:12:57 +00:00
class Comment(models.Model):
post = models.ForeignKey(Post)
body = models.TextField()
def __unicode__(self):
return self.body