Django Book 翻译
菜单>:
TOC
返回
原文:
If your database contains tables that refer to other tables (as most databases do), you might need to rearrange the order of the generated models so that models that refer to other models are ordered properly. For example, if model ``Book`` has a ``ForeignKey`` to model ``Author`` , model ``Author`` should be defined before model ``Book`` . If you need to create a relationship on a model that has not yet been defined, you can use the name of the model, rather than the model object itself.
翻译:
如果数据库中某张表引用了其他表(正如大多数数据库系统所做的那样),你需要适当的修改所生成model的顺序,以使得这种引用能够正确映射。例如,model Book拥有一个针对于model Author的外键,那么后者应该先于前者被定义。如果你需要为一个还没有被定义的model创建一个关系,那么你可以使用该model的名字,而不是model对象本身。
备注:
译者: