提供具有基本复合pk能力的基本模型。
django-compositepk的Python项目详细描述
提供CompositePKModel的django应用程序,允许 使用组合键检索和保存模型。
它仅限于上面的任务,并且任何超过此范围的模型的使用都不是 保证工作。
示例用法
具有复合pk的模型应该如下所示:
from composite_pk import composite class Lot(composite.CompositePKModel): auction = models.ForeignKey(Auction, primary_key=True) lot_number = models.IntegerField(primary_key=True) objects = composite.CompositePKManager()
所以它必须:
- subclass the ^{tt1}$,
- have two or more fields which set the ^{tt3}$ attribute to True, and
- use the ^{tt4}$ as the initial manager.