Make source label field unique.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-08-03 18:54:30 -04:00
parent 71ada209f6
commit 3aecf817ce
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-08-03 04:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sources', '0018_auto_20180608_0057'),
]
operations = [
migrations.AlterField(
model_name='source',
name='label',
field=models.CharField(db_index=True, max_length=64, unique=True, verbose_name='Label'),
),
]

View File

@@ -51,7 +51,9 @@ logger = logging.getLogger(__name__)
@python_2_unicode_compatible
class Source(models.Model):
label = models.CharField(max_length=64, verbose_name=_('Label'))
label = models.CharField(
db_index=True, max_length=64, unique=True, verbose_name=_('Label')
)
enabled = models.BooleanField(default=True, verbose_name=_('Enabled'))
objects = InheritanceManager()