topic name should be unique *per site*
This commit is contained in:
parent
28f7fb782c
commit
97c47a279d
24
proposals/migrations/0004_auto_20160711_2058.py
Normal file
24
proposals/migrations/0004_auto_20160711_2058.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.9.7 on 2016-07-11 20:58
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('proposals', '0003_auto_20160711_1933'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='topic',
|
||||||
|
name='name',
|
||||||
|
field=models.CharField(max_length=128, verbose_name='Name'),
|
||||||
|
),
|
||||||
|
migrations.AlterUniqueTogether(
|
||||||
|
name='topic',
|
||||||
|
unique_together=set([('site', 'name')]),
|
||||||
|
),
|
||||||
|
]
|
|
@ -18,11 +18,14 @@ class Topic(PonyConfModel):
|
||||||
|
|
||||||
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
site = models.ForeignKey(Site, on_delete=models.CASCADE)
|
||||||
|
|
||||||
name = models.CharField(max_length=128, verbose_name='Name', unique=True)
|
name = models.CharField(max_length=128, verbose_name='Name')
|
||||||
slug = AutoSlugField(populate_from='name', unique=True)
|
slug = AutoSlugField(populate_from='name', unique=True)
|
||||||
|
|
||||||
reviewers = models.ManyToManyField(User, blank=True)
|
reviewers = models.ManyToManyField(User, blank=True)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
unique_together = ('site', 'name')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user