diff --git a/drakul/users/migrations/0004_auto_20191121_0109.py b/drakul/users/migrations/0004_auto_20191121_0109.py new file mode 100644 index 0000000..783fb8b --- /dev/null +++ b/drakul/users/migrations/0004_auto_20191121_0109.py @@ -0,0 +1,26 @@ +# Generated by Django 2.2.6 on 2019-11-21 01:09 + +import django.core.validators +from django.db import migrations, models +import drakul.users.models + + +class Migration(migrations.Migration): + + dependencies = [ + ('users', '0003_create_admin'), + ] + + operations = [ + migrations.AlterModelManagers( + name='user', + managers=[ + ('objects', drakul.users.models.UserManager()), + ], + ), + migrations.AlterField( + model_name='character', + name='name', + field=models.CharField(max_length=12, unique=True, validators=[django.core.validators.MinLengthValidator(2)]), + ), + ] diff --git a/drakul/users/models.py b/drakul/users/models.py index f6e17aa..9a03147 100644 --- a/drakul/users/models.py +++ b/drakul/users/models.py @@ -1,7 +1,7 @@ from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import UserManager as DjangoUserManager from django.core.exceptions import ValidationError -from django.core.validators import RegexValidator, MinLengthValidator +from django.core.validators import MinLengthValidator from django.db import models, transaction @@ -88,8 +88,8 @@ class Character(models.Model): ) name = models.CharField( - max_length=12, # Blizzard limits character names to 2-12 ascii letters - validators=[MinLengthValidator(2), RegexValidator("^[a-zA-Z]+$")], + max_length=12, # Blizzard limits character names to 2-12 characters + validators=[MinLengthValidator(2)], unique=True )