[damned-lies] Make Release.name unique



commit 0209fd09018e36f9bf80b71bc0acaceedc6ddcda
Author: Claude Paroz <claude 2xlibre net>
Date:   Mon May 17 09:11:23 2021 +0200

    Make Release.name unique

 stats/migrations/0021_release_name_unique.py | 16 ++++++++++++++++
 stats/models.py                              |  2 +-
 2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/stats/migrations/0021_release_name_unique.py b/stats/migrations/0021_release_name_unique.py
new file mode 100644
index 00000000..347d7cda
--- /dev/null
+++ b/stats/migrations/0021_release_name_unique.py
@@ -0,0 +1,16 @@
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('stats', '0020_remove_pofile_figures_old'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='release',
+            name='name',
+            field=models.SlugField(max_length=20, unique=True),
+        ),
+    ]
diff --git a/stats/models.py b/stats/models.py
index fef75a74..363457b8 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -954,7 +954,7 @@ RELEASE_STATUS_CHOICES = (
 
 
 class Release(models.Model):
-    name = models.SlugField(max_length=20)
+    name = models.SlugField(max_length=20, unique=True)
     description = models.CharField(max_length=50)
     string_frozen = models.BooleanField(default=False)
     status = models.CharField(max_length=12, choices=RELEASE_STATUS_CHOICES)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]