blob: 637bbf62aff454f85bd39ce400a25c9f0fa2a5cf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
from django.db import models
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', db_column="publisher_id_column")
|