Browse Source

Project.badge_key must be not null and unique.

pull/214/head
Pēteris Caune 6 years ago
parent
commit
b5df5b3c6e
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
3 changed files with 21 additions and 1 deletions
  1. +18
    -0
      hc/accounts/migrations/0021_auto_20190112_2005.py
  2. +1
    -1
      hc/accounts/models.py
  3. +2
    -0
      hc/test.py

+ 18
- 0
hc/accounts/migrations/0021_auto_20190112_2005.py View File

@ -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),
),
]

+ 1
- 1
hc/accounts/models.py View File

@ -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):


+ 2
- 0
hc/test.py View File

@ -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)


Loading…
Cancel
Save