Add an index on User.name

This is needed because this field is queried when the songs list
is being searched.
This commit is contained in:
Daan Sprenkels
2018-10-28 17:23:10 +01:00
parent 3a4f9a336f
commit f1e6fef2d2
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 2.1.2 on 2018-10-28 16:22
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('marietje', '0006_user_blank_email'),
]
operations = [
migrations.AlterField(
model_name='user',
name='name',
field=models.CharField(blank=True, db_index=True, max_length=30, verbose_name='name'),
),
]

View File

@ -58,7 +58,7 @@ class User(AbstractBaseUser, PermissionsMixin):
'unique': _("A user with that username already exists."),
},
)
name = models.CharField(_('name'), max_length=30, blank=True)
name = models.CharField(_('name'), max_length=30, blank=True, db_index=True)
email = models.EmailField(
_('email address'),
blank=True,