djangodjango-modelsupdown

Value [...] not a valid choice, django-updown


I am trying to implemet django-updown https://github.com/weluse/django-updown. When I try to add vote trough the admin panel it says Value 1 not a valid choice.

This is the models.py from the application:

_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)

Do you have an idea what could be wrong?


Solution

  • At the end, there was no solution for this, so I installed django-ratings https://github.com/dcramer/django-ratings and it works fine. So if you have this kind of issue, I recommend this application.