Parcourir la source

Added uniquieness constraint to Secret

Jeremy Stretch il y a 8 ans
Parent
commit
c149dd2bd0

+ 19 - 0
netbox/secrets/migrations/0005_auto_20160614_2019.py

@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.9.5 on 2016-06-14 20:19
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('secrets', '0004_auto_20160407_1548'),
+    ]
+
+    operations = [
+        migrations.AlterUniqueTogether(
+            name='secret',
+            unique_together=set([('device', 'role', 'name')]),
+        ),
+    ]

+ 1 - 0
netbox/secrets/models.py

@@ -195,6 +195,7 @@ class Secret(models.Model):
 
     class Meta:
         ordering = ['device', 'role', 'name']
+        unique_together = ['device', 'role', 'name']
 
     def __init__(self, *args, **kwargs):
         self.plaintext = kwargs.pop('plaintext', None)