summaryrefslogtreecommitdiff
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
parent9c701ebba1f2ef403aab95354a8ae4efdb7df74c (diff)
Add last modified date to releases
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--feeds.py6
-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
5 files changed, 51 insertions, 0 deletions
diff --git a/feeds.py b/feeds.py
index 7247e95c..0f7fa5d7 100644
--- a/feeds.py
+++ b/feeds.py
@@ -159,6 +159,9 @@ class NewsFeed(Feed):
def item_pubdate(self, item):
return item.postdate
+ def item_updateddate(self, item):
+ return item.last_modified
+
def item_author_name(self, item):
return item.author.get_full_name()
@@ -191,6 +194,9 @@ class ReleaseFeed(Feed):
def item_pubdate(self, item):
return datetime.combine(item.release_date, time()).replace(tzinfo=utc)
+ def item_updateddate(self, item):
+ return item.last_modified
+
item_guid_is_permalink = False
def item_guid(self, item):
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,