From: Radek Czajka Date: Mon, 14 Jun 2010 10:47:21 +0000 (+0200) Subject: migration and oth. minor fixes X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/eb11e65717bdbddbc3ce08fa437739fd7bf5c279?hp=e92d6a9a4b4f3a29797f2f47e99787dce0ab525e migration and oth. minor fixes --- diff --git a/.gitignore b/.gitignore index 38a691b22..ffdcd2427 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,16 @@ dev.sqlite *~ *.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 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 dd2e6a2ff..7b2f2c517 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 @@ -19,8 +19,8 @@ class Migration(SchemaMigration): """ 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): @@ -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'}), diff --git a/apps/catalogue/migrations/0007_remove_empty_html.py b/apps/catalogue/migrations/0007_remove_empty_html.py index ec882b9c4..ca87ccb8b 100644 --- a/apps/catalogue/migrations/0007_remove_empty_html.py +++ b/apps/catalogue/migrations/0007_remove_empty_html.py @@ -9,7 +9,7 @@ class Migration(DataMigration): 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)): @@ -64,8 +64,8 @@ class Migration(DataMigration): '_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'}), diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 55a2b64b7..37e6c2e5e 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -131,8 +131,8 @@ class Book(models.Model): 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 @@ -376,10 +376,9 @@ class Book(models.Model): @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 = {} @@ -392,10 +391,9 @@ class Book(models.Model): @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() diff --git a/apps/infopages/migrations/0001_initial.py b/apps/infopages/migrations/0001_initial.py index 94ca2b301..a1289a2c6 100644 --- a/apps/infopages/migrations/0001_initial.py +++ b/apps/infopages/migrations/0001_initial.py @@ -50,8 +50,9 @@ class Migration(SchemaMigration): ('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'])