summaryrefslogtreecommitdiff
path: root/releng
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2014-10-26 22:23:56 -0500
committerDan McGee <dan@archlinux.org>2014-10-26 22:26:25 -0500
commitbd2bc6a1c58723502ef6c2e9f49248908a161b13 (patch)
tree9b813c6fe259fe7fa6caf8c8652545c79432192f /releng
parent9c701ebba1f2ef403aab95354a8ae4efdb7df74c (diff)
Add last modified date to releases
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'releng')
-rw-r--r--releng/admin.py1
-rw-r--r--releng/migrations/0002_release_last_modified.py22
-rw-r--r--releng/migrations/0003_release_populate_last_modified.py21
-rw-r--r--releng/models.py1
4 files changed, 45 insertions, 0 deletions
diff --git a/releng/admin.py b/releng/admin.py
index c7e6396e..9c93c4be 100644
--- a/releng/admin.py
+++ b/releng/admin.py
@@ -18,6 +18,7 @@ class ReleaseAdmin(admin.ModelAdmin):
list_display = ('version', 'release_date', 'kernel_version', 'available',
'created')
list_filter = ('available', 'release_date')
+ readonly_fields = ('created', 'last_modified')
SIMPLE_MODELS = (Architecture, BootType, Bootloader, ClockChoice, Filesystem,
diff --git a/releng/migrations/0002_release_last_modified.py b/releng/migrations/0002_release_last_modified.py
new file mode 100644
index 00000000..58502452
--- /dev/null
+++ b/releng/migrations/0002_release_last_modified.py
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import datetime
+from django.utils.timezone import utc
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('releng', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='release',
+ name='last_modified',
+ field=models.DateTimeField(default=datetime.datetime(2001, 1, 1, tzinfo=utc), editable=False),
+ preserve_default=False,
+ ),
+ ]
diff --git a/releng/migrations/0003_release_populate_last_modified.py b/releng/migrations/0003_release_populate_last_modified.py
new file mode 100644
index 00000000..ec7b6fda
--- /dev/null
+++ b/releng/migrations/0003_release_populate_last_modified.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+def forwards(apps, schema_editor):
+ Release = apps.get_model('releng', 'Release')
+ Release.objects.update(last_modified=models.F('created'))
+
+def backwards(apps, schema_editor):
+ pass
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('releng', '0002_release_last_modified'),
+ ]
+
+ operations = [
+ migrations.RunPython(forwards, backwards)
+ ]
diff --git a/releng/models.py b/releng/models.py
index c3ffd322..436308f2 100644
--- a/releng/models.py
+++ b/releng/models.py
@@ -120,6 +120,7 @@ class Release(models.Model):
md5_sum = models.CharField('MD5 digest', max_length=32, blank=True)
sha1_sum = models.CharField('SHA1 digest', max_length=40, blank=True)
created = models.DateTimeField(editable=False)
+ last_modified = models.DateTimeField(editable=False)
available = models.BooleanField(default=True)
info = models.TextField('Public information', blank=True)
torrent_data = models.TextField(blank=True,