Last active
November 16, 2018 20:38
-
-
Save m5wdev/4388a3b82c93f7055b5377fff171c518 to your computer and use it in GitHub Desktop.
Django 2.* positive integers validation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.core.validators import MaxValueValidator, MinValueValidator | |
class SomeModel(models.Model): | |
# ... | |
posiitive_integer = models.PositiveIntegerField(verbose_name='Some amount from 0 to 100', help_text='from 0 to 100', validators=[MinValueValidator(0), MaxValueValidator(100)]) | |
# ... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment