Skip to content

Instantly share code, notes, and snippets.

@edsu
Created August 30, 2011 02:58
Show Gist options
  • Select an option

  • Save edsu/1180064 to your computer and use it in GitHub Desktop.

Select an option

Save edsu/1180064 to your computer and use it in GitHub Desktop.
django models module
from django.db import models
class Book(models.Model):
title = models.CharField(max_length=15)
class Author(models.Model):
name = models.CharField(max_length=255)
book = models.ForeignKey('Book', related_name='authors')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment