我正在尝试实现 django-updown https://github.com/weluse/django-updown。当我尝试通过管理面板添加投票时,它说值 1 不是一个有效的选择。
这是应用程序中的 models.py:
_SCORE_TYPE_CHOICES = (
('-1', 'DISLIKE'),
('1', 'LIKE'),
)
SCORE_TYPES = dict((value, key) for key, value in _SCORE_TYPE_CHOICES)
class Vote(models.Model):
content_type = models.ForeignKey(ContentType, related_name="updown_votes")
object_id = models.PositiveIntegerField()
key = models.CharField(max_length=32)
score = models.SmallIntegerField(choices=_SCORE_TYPE_CHOICES)
user = models.ForeignKey(User, blank=True, null=True, related_name="updown_votes")
ip_address = models.IPAddressField()
date_added = models.DateTimeField(default=datetime.datetime.now, editable=False)
date_changed = models.DateTimeField(default=datetime.datetime.now, editable=False)
你知道有什么问题吗?