复合/复合主/唯一键与Django [英] Compound/Composite primary/unique key with Django
本文介绍了复合/复合主/唯一键与Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用Django创建带有复合(复合)主/唯一键的模型(以及表格)?
How can you create models (and thus tables) with a compound (composite) primary/unique key using Django?
推荐答案
Django不支持复合主键。您可以使用 Meta.unique_together
。
Django does not support compound primary keys. You can create a single compound unique key with Meta.unique_together
.
这篇关于复合/复合主/唯一键与Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文