diff options
-rw-r--r-- | api/migrations/0020_auto_20181124_1711.py | 24 | ||||
-rw-r--r-- | api/models.py | 6 |
2 files changed, 28 insertions, 2 deletions
diff --git a/api/migrations/0020_auto_20181124_1711.py b/api/migrations/0020_auto_20181124_1711.py new file mode 100644 index 00000000..3b625f9b --- /dev/null +++ b/api/migrations/0020_auto_20181124_1711.py @@ -0,0 +1,24 @@ +# Generated by Django 2.1.2 on 2018-11-24 17:11 + +import django.core.validators +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0019_user_in_guild'), + ] + + operations = [ + migrations.AlterField( + model_name='snakename', + name='name', + field=models.CharField(help_text="The regular name for this snake, e.g. 'Python'.", max_length=100, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(regex='^([^0-9])+$')]), + ), + migrations.AlterField( + model_name='snakename', + name='scientific', + field=models.CharField(help_text="The scientific name for this snake, e.g. 'Python bivittatus'.", max_length=150, validators=[django.core.validators.RegexValidator(regex='^([^0-9])+$')]), + ), + ] diff --git a/api/models.py b/api/models.py index bcf4af78..7623c86c 100644 --- a/api/models.py +++ b/api/models.py @@ -92,11 +92,13 @@ class SnakeName(ModelReprMixin, models.Model): name = models.CharField( primary_key=True, max_length=100, - help_text="The regular name for this snake, e.g. 'Python'." + help_text="The regular name for this snake, e.g. 'Python'.", + validators=[RegexValidator(regex=r'^([^0-9])+$')] ) scientific = models.CharField( max_length=150, - help_text="The scientific name for this snake, e.g. 'Python bivittatus'." + help_text="The scientific name for this snake, e.g. 'Python bivittatus'.", + validators=[RegexValidator(regex=r'^([^0-9])+$')] ) def __str__(self): |