From 40d43b2fe38d4a36f6f49d01d48a35775a094c86 Mon Sep 17 00:00:00 2001
From: Tanner Prestegard <tanner.prestegard@ligo.org>
Date: Mon, 30 Apr 2018 14:11:01 -0500
Subject: [PATCH] making N non-editable for EMObservations

---
 .../0021_emobservation_N_not_editable.py      | 20 +++++++++++++++++++
 gracedb/events/models.py                      |  2 +-
 .../0003_emobservation_N_not_editable.py      | 20 +++++++++++++++++++
 3 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 gracedb/events/migrations/0021_emobservation_N_not_editable.py
 create mode 100644 gracedb/superevents/migrations/0003_emobservation_N_not_editable.py

diff --git a/gracedb/events/migrations/0021_emobservation_N_not_editable.py b/gracedb/events/migrations/0021_emobservation_N_not_editable.py
new file mode 100644
index 000000000..26fa07dbb
--- /dev/null
+++ b/gracedb/events/migrations/0021_emobservation_N_not_editable.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.5 on 2018-04-30 17:56
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('events', '0020_tag_unique_name'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='emobservation',
+            name='N',
+            field=models.IntegerField(editable=False),
+        ),
+    ]
diff --git a/gracedb/events/models.py b/gracedb/events/models.py
index 3cda642d5..3428b9c52 100644
--- a/gracedb/events/models.py
+++ b/gracedb/events/models.py
@@ -386,7 +386,7 @@ class EMObservationBase(models.Model):
         abstract = True
         ordering = ['-created', '-N']
 
-    N = models.IntegerField(null=False)
+    N = models.IntegerField(null=False, editable=False)
     created = models.DateTimeField(auto_now_add=True)
     submitter  = models.ForeignKey(UserModel, null=False,
         related_name='%(app_label)s_%(class)s_set')
diff --git a/gracedb/superevents/migrations/0003_emobservation_N_not_editable.py b/gracedb/superevents/migrations/0003_emobservation_N_not_editable.py
new file mode 100644
index 000000000..5c9d4bf2f
--- /dev/null
+++ b/gracedb/superevents/migrations/0003_emobservation_N_not_editable.py
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.11.5 on 2018-04-30 17:56
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('superevents', '0002_superevent_label_unique_together'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='emobservation',
+            name='N',
+            field=models.IntegerField(editable=False),
+        ),
+    ]
-- 
GitLab