diff --git a/hc/accounts/migrations/0021_auto_20190112_2005.py b/hc/accounts/migrations/0021_auto_20190112_2005.py new file mode 100644 index 00000000..bda9ed3c --- /dev/null +++ b/hc/accounts/migrations/0021_auto_20190112_2005.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.5 on 2019-01-12 20:05 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('accounts', '0020_auto_20190112_1950'), + ] + + operations = [ + migrations.AlterField( + model_name='project', + name='badge_key', + field=models.CharField(max_length=150, unique=True), + ), + ] diff --git a/hc/accounts/models.py b/hc/accounts/models.py index 52c34323..000052db 100644 --- a/hc/accounts/models.py +++ b/hc/accounts/models.py @@ -240,7 +240,7 @@ class Project(models.Model): owner = models.ForeignKey(User, models.CASCADE) api_key = models.CharField(max_length=128, blank=True) api_key_readonly = models.CharField(max_length=128, blank=True) - badge_key = models.CharField(max_length=150, blank=True, null=True) + badge_key = models.CharField(max_length=150, unique=True) class Member(models.Model): diff --git a/hc/test.py b/hc/test.py index 29bfe226..eb8db788 100644 --- a/hc/test.py +++ b/hc/test.py @@ -15,6 +15,7 @@ class BaseTestCase(TestCase): self.alice.save() self.project = Project(owner=self.alice, api_key="X" * 32) + self.project.badge_key = self.alice.username self.project.save() self.profile = Profile(user=self.alice, api_key="X" * 32) @@ -28,6 +29,7 @@ class BaseTestCase(TestCase): self.bob.save() self.bobs_project = Project(owner=self.bob) + self.bobs_project.badge_key = self.bob.username self.bobs_project.save() self.bobs_profile = Profile(user=self.bob)