我想跟踪用户投票的问题和答案(上下),所以我就是这样做的,它不起作用
这是我的问题课
class Question(models.Model):
question = models.CharField(max_length = 200)
questionbody = models.TextField()
questioncontent = models.TextField()
author = models.ForeignKey(User)
tags = models.ManyToManyField(Tag)
timestamp = models.DateTimeField('question post date')
upvote = models.IntegerField(default = 0)
downvote = models.IntegerField(default = 0)
view = models.IntegerField(default = 0)
这是我的用户配置文件类(扩展用户)
class UserProfile(models.Model):
user = models.OneToOneField(User)
tags = models.ManyToManyField(Tag)
# favorite_question = models.ManyToManyField(Question)
# upvote_question = models.ManyToManyField(Question)
# downvote_question = models.ManyToManyField(Question)
# upvote_answer = models.ManyToManyField(Answer)
# downvote_answer = models.ManyToManyField(Answer)
integration = models.IntegerField(default = 0)
level = models.CharField(max_length = 100)
如果取消注释该行运行 synvdb 命令,它将显示错误
access for m2m field 'favorite-question' clashes with related m2m field 'question-userprofile_set',add a related_name argument to thr definition for 'favorite-question'
其余 4 行出现相同的错误。我真的是 django 新手,请帮忙