From 011cc77a41848ef9ca7d4aaa8486d997de81139b Mon Sep 17 00:00:00 2001 From: Owocki Date: Wed, 7 Nov 2018 15:08:36 -0700 Subject: [PATCH] makes profile.handle unique --- .../migrations/0112_auto_20181107_2208.py | 18 ++++++++++++++++++ app/dashboard/models.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 app/dashboard/migrations/0112_auto_20181107_2208.py diff --git a/app/dashboard/migrations/0112_auto_20181107_2208.py b/app/dashboard/migrations/0112_auto_20181107_2208.py new file mode 100644 index 00000000000..b061cc3bd30 --- /dev/null +++ b/app/dashboard/migrations/0112_auto_20181107_2208.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2018-11-07 22:08 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dashboard', '0111_auto_20181101_1922'), + ] + + operations = [ + migrations.AlterField( + model_name='profile', + name='handle', + field=models.CharField(db_index=True, max_length=255, unique=True), + ), + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 0bb53117afc..6cce0d6fba3 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -1560,7 +1560,7 @@ class Profile(SuperModel): user = models.OneToOneField(User, on_delete=models.SET_NULL, null=True, blank=True) data = JSONField() - handle = models.CharField(max_length=255, db_index=True) + handle = models.CharField(max_length=255, db_index=True, unique=True) avatar = models.ForeignKey('avatar.Avatar', on_delete=models.SET_NULL, null=True, blank=True) last_sync_date = models.DateTimeField(null=True) email = models.CharField(max_length=255, blank=True, db_index=True)