2008-08-17 04:59:06 +08:00
|
|
|
from django.db import models
|
|
|
|
|
2010-10-12 09:54:19 +08:00
|
|
|
|
2008-08-17 04:59:06 +08:00
|
|
|
class Publisher(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Author(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
|
|
|
|
class Book(models.Model):
|
|
|
|
name = models.CharField(max_length=100)
|
|
|
|
authors = models.ManyToManyField(Author, related_name='books')
|
|
|
|
publisher = models.ForeignKey(Publisher, related_name='books')
|