Merge remote branch 'klitynski/master'
[wolnelektury.git] / apps / catalogue / migrations / 0006_epub_tag_counters_and_ltags_descendants.py
index dd2e6a2..b990fc3 100644 (file)
@@ -14,13 +14,13 @@ 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 """
 
         # Adding fields
-        db.add_column('catalogue_book', '_tag_counter', self.gf('catalogue.fields.JSONField')(default=''), keep_default=False)
-        db.add_column('catalogue_book', '_theme_counter', self.gf('catalogue.fields.JSONField')(default=''), keep_default=False)
+        db.add_column('catalogue_book', '_tag_counter', self.gf('catalogue.fields.JSONField')(null=True))
+        db.add_column('catalogue_book', '_theme_counter', self.gf('catalogue.fields.JSONField')(null=True))
         db.add_column('catalogue_book', 'epub_file', self.gf('django.db.models.fields.files.FileField')(default='', max_length=100, blank=True), keep_default=False)
 
         def ltag_descendants(book, ltags=None):
@@ -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'},
@@ -104,8 +104,8 @@ class Migration(SchemaMigration):
             '_short_html_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
             '_short_html_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
             '_short_html_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
-            '_tag_counter': ('catalogue.fields.JSONField', [], {'default': "''"}),
-            '_theme_counter': ('catalogue.fields.JSONField', [], {'default': "''"}),
+            '_tag_counter': ('catalogue.fields.JSONField', [], {'null': 'True'}),
+            '_theme_counter': ('catalogue.fields.JSONField', [], {'null': 'True'}),
             'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
             'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
             'epub_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
@@ -182,5 +182,5 @@ class Migration(SchemaMigration):
             'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
         }
     }
-    
+
     complete_apps = ['catalogue']