Skip to content

Hint 5 spoiler

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

We're still editing the Profile model. Go to your shoe_size field and add the following options:

  • null=True
  • blank=True

Now if you clicked on the link to the documentation you should've seen that these were the first two in the list ;)

.......

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)],
        blank=True,
        null=True,
    )
    
.......

Now that the field is done we should generate and execute a new migration:

  1. cd into the website/members directory.
  2. Use ../manage.py makemigrations.
  3. This creates a new migration in the migrations folder.
  4. Update your local database by running ../manage.py migrate.
Clone this wiki locally