【发布时间】:2018-06-05 05:25:55
【问题描述】:
我看过这个:https://groups.google.com/forum/#!topic/django-users/VEDZtuND2XM
但在那个答案上,罗纳尔多说的是方便而不是查询速度。
ForeignKey(unique=true) 和 OneToOneField 之间是否存在速度或性能差异?
或者说使用 OneToOneField 比 ForeignKey(unique=true) 有什么其他优势吗?
【问题讨论】:
-
反向访问实例更直观:FK:
rel_model_instance.related_name.get(),1to1:rel_model_instance.related_name
标签: django