From e73ae49788ae66900f3def48c6747e1ec8dc6477 Mon Sep 17 00:00:00 2001
From: Jorran de Wit <jorrandewit@outlook.com>
Date: Sat, 1 Jul 2017 13:56:46 +0200
Subject: [PATCH] Make `noted_on` editable

---
 production/admin.py                           |  1 +
 .../migrations/0009_auto_20170701_1356.py     | 21 +++++++++++++++++++
 production/models.py                          |  2 +-
 scipost/migrations/0059_auto_20170701_1356.py | 19 +++++++++++++++++
 4 files changed, 42 insertions(+), 1 deletion(-)
 create mode 100644 production/migrations/0009_auto_20170701_1356.py
 create mode 100644 scipost/migrations/0059_auto_20170701_1356.py

diff --git a/production/admin.py b/production/admin.py
index dd9a78491..7969db8ec 100644
--- a/production/admin.py
+++ b/production/admin.py
@@ -10,6 +10,7 @@ def event_count(obj):
 class ProductionEventInline(admin.TabularInline):
     model = ProductionEvent
     extra = 1
+    readonly_fields = ()
 
 
 class ProductionStreamAdmin(admin.ModelAdmin):
diff --git a/production/migrations/0009_auto_20170701_1356.py b/production/migrations/0009_auto_20170701_1356.py
new file mode 100644
index 000000000..9aa834bef
--- /dev/null
+++ b/production/migrations/0009_auto_20170701_1356.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-07-01 11:56
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+import django.utils.timezone
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('production', '0008_auto_20170623_0833'),
+    ]
+
+    operations = [
+        migrations.AlterField(
+            model_name='productionevent',
+            name='noted_on',
+            field=models.DateTimeField(default=django.utils.timezone.now),
+        ),
+    ]
diff --git a/production/models.py b/production/models.py
index 6e11ce0e1..6b515e8c2 100644
--- a/production/models.py
+++ b/production/models.py
@@ -38,7 +38,7 @@ class ProductionEvent(models.Model):
     stream = models.ForeignKey(ProductionStream, on_delete=models.CASCADE)
     event = models.CharField(max_length=64, choices=PRODUCTION_EVENTS)
     comments = models.TextField(blank=True, null=True)
-    noted_on = models.DateTimeField(auto_now_add=True)
+    noted_on = models.DateTimeField(default=timezone.now)
     noted_by = models.ForeignKey(Contributor, on_delete=models.CASCADE)
     duration = models.DurationField(blank=True, null=True)
 
diff --git a/scipost/migrations/0059_auto_20170701_1356.py b/scipost/migrations/0059_auto_20170701_1356.py
new file mode 100644
index 000000000..de6151cfd
--- /dev/null
+++ b/scipost/migrations/0059_auto_20170701_1356.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+# Generated by Django 1.10.3 on 2017-07-01 11:56
+from __future__ import unicode_literals
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+
+    dependencies = [
+        ('scipost', '0058_auto_20170624_2003'),
+    ]
+
+    operations = [
+        migrations.AlterModelOptions(
+            name='unavailabilityperiod',
+            options={'ordering': ['-start']},
+        ),
+    ]
-- 
GitLab