我最近从 1.7 切换到 Django 1.8.2,但遇到了一些问题,例如在我的一个模型中:
class Author(models.Model):
author = models.ForeignKey(UserProfile, blank=False, primary_key=True)
timestamp = models.DateTimeField(auto_now_add=True)
但是当我运行服务器时,我遇到了以下警告:
WARNINGS:
exam.Author.author: (fields.W342) Setting unique=True on a ForeignKey has the same effect as using a OneToOneField.
HINT: ForeignKey(unique=True) is usually better served by a OneToOneField.
我应该怎么办?