X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/eb11e65717bdbddbc3ce08fa437739fd7bf5c279..089e42600c995f8b8b23c69ba93419167c0ae5be:/apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py diff --git a/apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py b/apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py index 7b2f2c517..b990fc33f 100644 --- a/apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py +++ b/apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py @@ -14,7 +14,7 @@ def get_ltag(book, orm): class Migration(SchemaMigration): - + def forwards(self, orm): """ Add _tag_counter and make sure all books carry their ancestors' l-tags """ @@ -32,7 +32,7 @@ class Migration(SchemaMigration): ltag = get_ltag(book, orm) for child in book.children.all(): ltag_descendants(child, ltags + [ltag]) - + if not db.dry_run: try: book_ct = orm['contenttypes.contenttype'].objects.get(app_label='catalogue', model='book') @@ -42,8 +42,8 @@ class Migration(SchemaMigration): orm.TagRelation.objects.filter(content_type=book_ct, tag__category='book').delete() for book in orm.Book.objects.filter(parent=None): ltag_descendants(book) - - + + def backwards(self, orm): """ Delete _tag_counter and make sure books carry own l-tag. """ @@ -61,8 +61,8 @@ class Migration(SchemaMigration): orm.TagRelation.objects.filter(content_type=book_ct, tag__category='book').delete() for book in orm.Book.objects.filter(parent=None): orm.TagRelation(object_id=book.pk, tag=get_ltag(book, orm), content_type=book_ct).save() - - + + models = { 'auth.group': { 'Meta': {'object_name': 'Group'}, @@ -182,5 +182,5 @@ class Migration(SchemaMigration): 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) } } - + complete_apps = ['catalogue']