diff --git a/polls/models.py b/polls/models.py index 63e2c0d..101fb9b 100644 --- a/polls/models.py +++ b/polls/models.py @@ -14,6 +14,7 @@ import datetime from django.db import models from django.utils import timezone from django.contrib import admin +from django.core.validators import MaxValueValidator, MinValueValidator class Question(models.Model): @@ -90,7 +91,7 @@ class Choice(models.Model): question = models.ForeignKey(Question, on_delete=models.CASCADE) choice_text = models.CharField(max_length=200) - votes = models.IntegerField(default=0) + votes = models.PositiveIntegerField(default=0, validators=[MinValueValidator(0), MaxValueValidator(2147483647)]) def __str__(self): """