Created
April 7, 2012 06:52
-
-
Save kirs/2326021 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Post(models.Model): | |
title = models.CharField(max_length=40) | |
content = models.TextField() | |
def __unicode__(self): | |
return self.title | |
class Comment(models.Model): | |
author = models.CharField(max_length=100) | |
email = models.CharField(max_length=100) | |
text = models.TextField() | |
post = models.ForeignKey(Post) | |
def __unicode__(self): | |
return self.text + " (" + self.post.title + ")" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment