From: Radek Czajka Date: Thu, 4 Oct 2012 11:10:22 +0000 (+0200) Subject: migration fix X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/40c6dee13a7eed074e98867924a7e56e771689f6?ds=inline;hp=-c migration fix --- 40c6dee13a7eed074e98867924a7e56e771689f6 diff --git a/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py b/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py index 2110ee4..f8e8ee8 100644 --- a/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py +++ b/migdal/migrations/0005_auto__add_field_entry_changed_at__add_field_entry_published_at_pl__add.py @@ -25,11 +25,13 @@ class Migration(SchemaMigration): if not db.dry_run: for entry in orm['migdal.Entry'].objects.all(): + update_info = {} if entry.published_pl: - entry.published_at_pl = entry.date + update_info['published_at_pl'] = entry.date if entry.published_en: - entry.published_at_en = entry.date - entry.save() + update_info['published_at_en'] = entry.date + update_info['changed_at'] = entry.date + orm['migdal.Entry'].objects.filter(pk=entry.pk).update(**update_info) def backwards(self, orm):