Skip to content

Instantly share code, notes, and snippets.

@kirs
Created April 7, 2012 06:52
Show Gist options
  • Save kirs/2326021 to your computer and use it in GitHub Desktop.
Save kirs/2326021 to your computer and use it in GitHub Desktop.
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