diff options
author | Dan McGee <dan@archlinux.org> | 2014-10-26 22:23:56 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2014-10-26 22:26:25 -0500 |
commit | bd2bc6a1c58723502ef6c2e9f49248908a161b13 (patch) | |
tree | 9b813c6fe259fe7fa6caf8c8652545c79432192f /releng/migrations | |
parent | 9c701ebba1f2ef403aab95354a8ae4efdb7df74c (diff) |
Add last modified date to releases
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'releng/migrations')
-rw-r--r-- | releng/migrations/0002_release_last_modified.py | 22 | ||||
-rw-r--r-- | releng/migrations/0003_release_populate_last_modified.py | 21 |
2 files changed, 43 insertions, 0 deletions
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) + ] |