*~
*.orig
+# Compress output
+/wolnelektury/static/css/all.min*.css
+/wolnelektury/static/js/all*.min.js
+/wolnelektury/static/js/jquery.min.js
+
# Python garbage
*.pyc
.coverage
pip-log.txt
+nosetests.xml
# Mac OS X garbage
.DS_Store
""" 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):
'_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'}),
def forwards(self, orm):
""" Look for HTML files without any real content and delete them """
from lxml import etree
- from librarian import html_has_content
+ from librarian.html import html_has_content
for book in orm.Book.objects.exclude(html_file=''):
if not html_has_content(etree.parse(book.html_file)):
'_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'}),
tagged = managers.ModelTaggedItemManager(Tag)
tags = managers.TagDescriptor(Tag)
- _tag_counter = JSONField(editable=False, default='')
- _theme_counter = JSONField(editable=False, default='')
+ _tag_counter = JSONField(null=True, editable=False)
+ _theme_counter = JSONField(null=True, editable=False)
class AlreadyExists(Exception):
pass
@property
def tag_counter(self):
- if self._tag_counter == '':
+ if self._tag_counter is None:
return self.refresh_tag_counter()
return dict((int(k), v) for k, v in self.get__tag_counter_value().iteritems())
- #return self.get__tag_counter_value()
def refresh_theme_counter(self):
tags = {}
@property
def theme_counter(self):
- if self._theme_counter == '':
+ if self._theme_counter is None:
return self.refresh_theme_counter()
return dict((int(k), v) for k, v in self.get__theme_counter_value().iteritems())
- return self.get__theme_counter_value()
('page_title_ru', self.gf('django.db.models.fields.CharField')(max_length=120, null=True, blank=True)),
))
- from django.core.management import call_command
- call_command("loaddata", "wl_data")
+ if not db.dry_run:
+ from django.core.management import call_command
+ call_command("loaddata", "wl_data")
db.send_create_signal('infopages', ['InfoPage'])