Skip to content

Commit

Permalink
Add min length of 3 for ingredient name
Browse files Browse the repository at this point in the history
  • Loading branch information
austin-leung committed Dec 5, 2020
1 parent 737e494 commit 403555b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions wger/nutrition/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
from django.core.exceptions import ValidationError
from django.core.validators import (
MaxValueValidator,
MinValueValidator
MinValueValidator,
MinLengthValidator
)
from django.db import models
from django.template.loader import render_to_string
Expand Down Expand Up @@ -289,7 +290,8 @@ class Meta:
editable=False)

name = models.CharField(max_length=200,
verbose_name=_('Name'), )
verbose_name=_('Name'),
validators=[MinLengthValidator(3)])

energy = models.IntegerField(verbose_name=_('Energy'),
help_text=_('In kcal per 100g'))
Expand Down

0 comments on commit 403555b

Please sign in to comment.