1.基于对象的正向查询和反向查询
在python---django中orm的使用(1)中也提到了正向和反向查找
表:一对多 书籍和出版社
class Book(models.Model): title = models.CharField(max_length=100) authors = models.ManyToManyField(Author) publisher = models.ForeignKey(Publisher) publication_date = models.DateField() price=models.DecimalField(max_digits=5,decimal_places=2,default=10) def __str__(self): return self.title