Skip to content

Hint 4 spoiler

Sébastiaan edited this page Mar 5, 2020 · 2 revisions

Once again go back to the Profile model. Find your shoe_size field and add a new option validators=[MinValueValidator(39), MaxValueValidator(47)] to the field.

.......

class Profile(models.Model):
    """This class holds extra information about a member"""

.......

    # ---- Personal information ------

    programme = models.CharField(
        max_length=20,
        choices=PROGRAMME_CHOICES,
        verbose_name=_('Study programme'),
        blank=True,
        null=True,
    )

    shoe_size = models.IntegerField(
        verbose_name=_('Shoe size'),
        validators=[MinValueValidator(39), MaxValueValidator(47)]
    )
    
.......

Don't forget to import the validators you're using!

Clone this wiki locally