aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/migrations/0021_add_special_snake_validator.py19
-rw-r--r--api/models.py3
2 files changed, 21 insertions, 1 deletions
diff --git a/api/migrations/0021_add_special_snake_validator.py b/api/migrations/0021_add_special_snake_validator.py
new file mode 100644
index 00000000..d41b96e5
--- /dev/null
+++ b/api/migrations/0021_add_special_snake_validator.py
@@ -0,0 +1,19 @@
+# Generated by Django 2.1.2 on 2018-11-25 14:59
+
+import django.core.validators
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0020_add_snake_field_validators'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='specialsnake',
+ name='name',
+ field=models.CharField(help_text='A special snake name.', max_length=140, primary_key=True, serialize=False, validators=[django.core.validators.RegexValidator(regex='^([^0-9])+$')]),
+ ),
+ ]
diff --git a/api/models.py b/api/models.py
index 7623c86c..c67f558d 100644
--- a/api/models.py
+++ b/api/models.py
@@ -111,7 +111,8 @@ class SpecialSnake(ModelReprMixin, models.Model):
name = models.CharField(
max_length=140,
primary_key=True,
- help_text='A special snake name.'
+ help_text='A special snake name.',
+ validators=[RegexValidator(regex=r'^([^0-9])+$')]
)
info = models.TextField(
help_text='Info about a special snake.'