Skip to content

Instantly share code, notes, and snippets.

@kennethlove
Created November 9, 2012 22:04
Show Gist options
  • Save kennethlove/4048594 to your computer and use it in GitHub Desktop.
Save kennethlove/4048594 to your computer and use it in GitHub Desktop.
class Book(models.Model):
title = models.CharField(max_length=255)
author = models.CharField(max_length=255) # you probably want this to be an FK to another model
class BookList(models.Model):
title = models.CharField(max_length=255)
user = models.ForeignKey(User, related_name="booklists") # imported from django.contrib.auth.models
books = models.ManyToMany(Book, related_name="lists")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment