From 458886cbf21bca4d33ac5c44e90a5e9d71629216 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Thu, 16 Sep 2010 17:14:55 +0200 Subject: [PATCH] django 1.2, compatibility fixes --- apps/catalogue/fields.py | 5 +- apps/catalogue/migrations/0001_initial.py | 178 ++++++++++---- ...auto__add_bookstub__add_field_tag_death.py | 137 ----------- .../0003_fix_book_count_on_shelves.py | 138 ----------- .../0004_book_html_shorts_translations.py | 172 ------------- .../0005_fragment_html_shorts_translations.py | 180 -------------- ...epub_tag_counters_and_ltags_descendants.py | 186 -------------- .../migrations/0007_remove_empty_html.py | 146 ----------- .../0008_unique_tag_category_slug.py | 147 ------------ .../0009_chg_book_count__heavy_cleaning.py | 226 ------------------ .../migrations/0010_auto__add_filerecord.py | 156 ------------ apps/catalogue/views.py | 2 +- apps/newtagging/models.py | 14 +- apps/sponsors/fields.py | 2 +- requirements.txt | 2 +- wolnelektury/settings.py | 16 +- wolnelektury/urls.py | 2 +- 17 files changed, 162 insertions(+), 1547 deletions(-) delete mode 100644 apps/catalogue/migrations/0002_auto__add_bookstub__add_field_tag_death.py delete mode 100644 apps/catalogue/migrations/0003_fix_book_count_on_shelves.py delete mode 100644 apps/catalogue/migrations/0004_book_html_shorts_translations.py delete mode 100644 apps/catalogue/migrations/0005_fragment_html_shorts_translations.py delete mode 100644 apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py delete mode 100644 apps/catalogue/migrations/0007_remove_empty_html.py delete mode 100644 apps/catalogue/migrations/0008_unique_tag_category_slug.py delete mode 100644 apps/catalogue/migrations/0009_chg_book_count__heavy_cleaning.py delete mode 100644 apps/catalogue/migrations/0010_auto__add_filerecord.py diff --git a/apps/catalogue/fields.py b/apps/catalogue/fields.py index 11c730c71..e2d94b915 100644 --- a/apps/catalogue/fields.py +++ b/apps/catalogue/fields.py @@ -14,7 +14,6 @@ from django.utils import simplejson as json from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ -from south.modelsinspector import add_introspection_rules class JSONEncoder(json.JSONEncoder): @@ -53,7 +52,7 @@ class JSONField(models.TextField): defaults.update(kwargs) return super(JSONField, self).formfield(**defaults) - def db_type(self): + def db_type(self, connection): return 'text' def get_internal_type(self): @@ -70,8 +69,6 @@ class JSONField(models.TextField): return setattr(model_instance, self.attname, dumps(json)) setattr(cls, 'set_%s_value' % self.name, set_value) -add_introspection_rules([], ["^catalogue\.fields\.JSONField"]) - class JQueryAutoCompleteWidget(forms.TextInput): def __init__(self, source, options=None, *args, **kwargs): diff --git a/apps/catalogue/migrations/0001_initial.py b/apps/catalogue/migrations/0001_initial.py index 2aabb8237..045b2f204 100644 --- a/apps/catalogue/migrations/0001_initial.py +++ b/apps/catalogue/migrations/0001_initial.py @@ -7,27 +7,31 @@ from django.db import models class Migration(SchemaMigration): def forwards(self, orm): - + # Adding model 'Tag' db.create_table('catalogue_tag', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=50, db_index=True)), + ('slug', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)), + ('sort_key', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)), ('category', self.gf('django.db.models.fields.CharField')(max_length=50, db_index=True)), - ('gazeta_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), ('description', self.gf('django.db.models.fields.TextField')(blank=True)), - ('main_page', self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True, blank=True)), - ('sort_key', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('wiki_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), + ('main_page', self.gf('django.db.models.fields.BooleanField')(default=False, db_index=True)), ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120, db_index=True)), - ('book_count', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=50, db_index=True)), + ('book_count', self.gf('django.db.models.fields.IntegerField')(null=True)), + ('death', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('gazeta_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), + ('wiki_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), )) db.send_create_signal('catalogue', ['Tag']) + # Adding unique constraint on 'Tag', fields ['slug', 'category'] + db.create_unique('catalogue_tag', ['slug', 'category']) + # Adding model 'TagRelation' db.create_table('catalogue_tag_relation', ( - ('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='items', to=orm['catalogue.Tag'])), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='items', to=orm['catalogue.Tag'])), ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])), ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)), )) @@ -38,40 +42,87 @@ class Migration(SchemaMigration): # Adding model 'Book' db.create_table('catalogue_book', ( - ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])), - ('mp3_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), - ('xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), - ('description', self.gf('django.db.models.fields.TextField')(blank=True)), - ('wiki_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('title', self.gf('django.db.models.fields.CharField')(max_length=120)), - ('txt_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120, db_index=True)), + ('description', self.gf('django.db.models.fields.TextField')(blank=True)), ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), - ('pdf_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('html_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), ('_short_html', self.gf('django.db.models.fields.TextField')()), + ('_short_html_de', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_en', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_es', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_fr', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_lt', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_pl', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_ru', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_uk', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), ('parent_number', self.gf('django.db.models.fields.IntegerField')(default=0)), - ('ogg_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), - ('odt_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120, db_index=True)), - ('gazeta_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), ('extra_info', self.gf('catalogue.fields.JSONField')()), + ('gazeta_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), + ('wiki_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)), + ('xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('html_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('pdf_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('epub_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('odt_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('txt_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('mp3_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('ogg_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)), + ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])), + ('_tag_counter', self.gf('catalogue.fields.JSONField')(null=True)), + ('_theme_counter', self.gf('catalogue.fields.JSONField')(null=True)), )) db.send_create_signal('catalogue', ['Book']) # Adding model 'Fragment' db.create_table('catalogue_fragment', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('text', self.gf('django.db.models.fields.TextField')()), - ('anchor', self.gf('django.db.models.fields.CharField')(max_length=120)), + ('short_text', self.gf('django.db.models.fields.TextField')()), ('_short_html', self.gf('django.db.models.fields.TextField')()), + ('_short_html_de', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_en', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_es', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_fr', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_lt', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_pl', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_ru', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('_short_html_uk', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), + ('anchor', self.gf('django.db.models.fields.CharField')(max_length=120)), ('book', self.gf('django.db.models.fields.related.ForeignKey')(related_name='fragments', to=orm['catalogue.Book'])), - ('short_text', self.gf('django.db.models.fields.TextField')()), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), )) db.send_create_signal('catalogue', ['Fragment']) + # Adding model 'BookStub' + db.create_table('catalogue_bookstub', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('title', self.gf('django.db.models.fields.CharField')(max_length=120)), + ('author', self.gf('django.db.models.fields.CharField')(max_length=120)), + ('pd', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), + ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120, db_index=True)), + ('translator', self.gf('django.db.models.fields.TextField')(blank=True)), + ('translator_death', self.gf('django.db.models.fields.TextField')(blank=True)), + )) + db.send_create_signal('catalogue', ['BookStub']) + + # Adding model 'FileRecord' + db.create_table('catalogue_filerecord', ( + ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('slug', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)), + ('type', self.gf('django.db.models.fields.CharField')(max_length=20, db_index=True)), + ('sha1', self.gf('django.db.models.fields.CharField')(max_length=40)), + ('time', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), + )) + db.send_create_signal('catalogue', ['FileRecord']) + def backwards(self, orm): + + # Removing unique constraint on 'TagRelation', fields ['tag', 'content_type', 'object_id'] + db.delete_unique('catalogue_tag_relation', ['tag_id', 'content_type_id', 'object_id']) + + # Removing unique constraint on 'Tag', fields ['slug', 'category'] + db.delete_unique('catalogue_tag', ['slug', 'category']) # Deleting model 'Tag' db.delete_table('catalogue_tag') @@ -79,25 +130,28 @@ class Migration(SchemaMigration): # Deleting model 'TagRelation' db.delete_table('catalogue_tag_relation') - # Removing unique constraint on 'TagRelation', fields ['tag', 'content_type', 'object_id'] - db.delete_unique('catalogue_tag_relation', ['tag_id', 'content_type_id', 'object_id']) - # Deleting model 'Book' db.delete_table('catalogue_book') # Deleting model 'Fragment' db.delete_table('catalogue_fragment') + # Deleting model 'BookStub' + db.delete_table('catalogue_bookstub') + + # Deleting model 'FileRecord' + db.delete_table('catalogue_filerecord') + models = { 'auth.group': { 'Meta': {'object_name': 'Group'}, 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) + 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) }, 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, + 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), @@ -108,22 +162,33 @@ class Migration(SchemaMigration): 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), + 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), + 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), + 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), + 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) }, 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, + 'Meta': {'ordering': "('title',)", 'object_name': 'Book'}, '_short_html': ('django.db.models.fields.TextField', [], {}), + '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_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', [], {'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'}), 'extra_info': ('catalogue.fields.JSONField', [], {}), 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), @@ -140,9 +205,35 @@ class Migration(SchemaMigration): 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) }, + 'catalogue.bookstub': { + 'Meta': {'ordering': "('title',)", 'object_name': 'BookStub'}, + 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), + 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), + 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), + 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) + }, + 'catalogue.filerecord': { + 'Meta': {'ordering': "('-time', '-slug', '-type')", 'object_name': 'FileRecord'}, + 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), + 'time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + 'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}) + }, 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, + 'Meta': {'ordering': "('book', 'anchor')", 'object_name': 'Fragment'}, '_short_html': ('django.db.models.fields.TextField', [], {}), + '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), + '_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}), 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), @@ -150,15 +241,16 @@ class Migration(SchemaMigration): 'text': ('django.db.models.fields.TextField', [], {}) }, 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), + 'Meta': {'ordering': "('sort_key',)", 'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'}, + 'book_count': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), + 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), + 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) @@ -171,7 +263,7 @@ class Migration(SchemaMigration): 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) }, 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, + 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), diff --git a/apps/catalogue/migrations/0002_auto__add_bookstub__add_field_tag_death.py b/apps/catalogue/migrations/0002_auto__add_bookstub__add_field_tag_death.py deleted file mode 100644 index c278a83a0..000000000 --- a/apps/catalogue/migrations/0002_auto__add_bookstub__add_field_tag_death.py +++ /dev/null @@ -1,137 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'BookStub' - db.create_table('catalogue_bookstub', ( - ('author', self.gf('django.db.models.fields.CharField')(max_length=120)), - ('title', self.gf('django.db.models.fields.CharField')(max_length=120)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('translator', self.gf('django.db.models.fields.TextField')(blank=True)), - ('translator_death', self.gf('django.db.models.fields.TextField')(blank=True)), - ('pd', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120, db_index=True)), - )) - db.send_create_signal('catalogue', ['BookStub']) - - # Adding field 'Tag.death' - db.add_column('catalogue_tag', 'death', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting model 'BookStub' - db.delete_table('catalogue_bookstub') - - # Deleting field 'Tag.death' - db.delete_column('catalogue_tag', 'death') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0003_fix_book_count_on_shelves.py b/apps/catalogue/migrations/0003_fix_book_count_on_shelves.py deleted file mode 100644 index 8180311b2..000000000 --- a/apps/catalogue/migrations/0003_fix_book_count_on_shelves.py +++ /dev/null @@ -1,138 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import connection, models -qn = connection.ops.quote_name - -class Migration(DataMigration): - - def forwards(self, orm): - model = orm.Book - model_table = qn(model._meta.db_table) - for tag in orm.Tag.objects.exclude(user=None): - query = """ - SELECT COUNT(%(model_pk)s) -- count books - FROM %(model)s, %(tagged_item)s -- from books x tagged - WHERE - %(tagged_item)s.tag_id=%(tag_id)s -- get only the shelf - AND %(model_pk)s = %(tagged_item)s.object_id -- get only books on the shelf - GROUP BY %(tagged_item)s.tag_id""" % { - 'model_pk': '%s.%s' % (model_table, qn(model._meta.pk.column)), - 'model': model_table, - 'tagged_item': qn(orm.TagRelation._meta.db_table), - 'tag_id': tag.pk, - } - - cursor = connection.cursor() - cursor.execute(query) - book_count = (cursor.fetchone() or (0,))[0] - - tag.book_count = book_count - tag.save() - - def backwards(self, orm): - "Write your backwards methods here." - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0004_book_html_shorts_translations.py b/apps/catalogue/migrations/0004_book_html_shorts_translations.py deleted file mode 100644 index d9e7b5303..000000000 --- a/apps/catalogue/migrations/0004_book_html_shorts_translations.py +++ /dev/null @@ -1,172 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Book._short_html_en' - db.add_column('catalogue_book', '_short_html_en', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_es' - db.add_column('catalogue_book', '_short_html_es', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_de' - db.add_column('catalogue_book', '_short_html_de', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_fr' - db.add_column('catalogue_book', '_short_html_fr', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_uk' - db.add_column('catalogue_book', '_short_html_uk', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_pl' - db.add_column('catalogue_book', '_short_html_pl', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_ru' - db.add_column('catalogue_book', '_short_html_ru', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Book._short_html_lt' - db.add_column('catalogue_book', '_short_html_lt', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Book._short_html_en' - db.delete_column('catalogue_book', '_short_html_en') - - # Deleting field 'Book._short_html_es' - db.delete_column('catalogue_book', '_short_html_es') - - # Deleting field 'Book._short_html_de' - db.delete_column('catalogue_book', '_short_html_de') - - # Deleting field 'Book._short_html_fr' - db.delete_column('catalogue_book', '_short_html_fr') - - # Deleting field 'Book._short_html_uk' - db.delete_column('catalogue_book', '_short_html_uk') - - # Deleting field 'Book._short_html_pl' - db.delete_column('catalogue_book', '_short_html_pl') - - # Deleting field 'Book._short_html_ru' - db.delete_column('catalogue_book', '_short_html_ru') - - # Deleting field 'Book._short_html_lt' - db.delete_column('catalogue_book', '_short_html_lt') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0005_fragment_html_shorts_translations.py b/apps/catalogue/migrations/0005_fragment_html_shorts_translations.py deleted file mode 100644 index 8322b4c24..000000000 --- a/apps/catalogue/migrations/0005_fragment_html_shorts_translations.py +++ /dev/null @@ -1,180 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding field 'Fragment._short_html_de' - db.add_column('catalogue_fragment', '_short_html_de', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_pl' - db.add_column('catalogue_fragment', '_short_html_pl', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_lt' - db.add_column('catalogue_fragment', '_short_html_lt', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_en' - db.add_column('catalogue_fragment', '_short_html_en', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_fr' - db.add_column('catalogue_fragment', '_short_html_fr', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_ru' - db.add_column('catalogue_fragment', '_short_html_ru', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_es' - db.add_column('catalogue_fragment', '_short_html_es', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - # Adding field 'Fragment._short_html_uk' - db.add_column('catalogue_fragment', '_short_html_uk', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False) - - - def backwards(self, orm): - - # Deleting field 'Fragment._short_html_de' - db.delete_column('catalogue_fragment', '_short_html_de') - - # Deleting field 'Fragment._short_html_pl' - db.delete_column('catalogue_fragment', '_short_html_pl') - - # Deleting field 'Fragment._short_html_lt' - db.delete_column('catalogue_fragment', '_short_html_lt') - - # Deleting field 'Fragment._short_html_en' - db.delete_column('catalogue_fragment', '_short_html_en') - - # Deleting field 'Fragment._short_html_fr' - db.delete_column('catalogue_fragment', '_short_html_fr') - - # Deleting field 'Fragment._short_html_ru' - db.delete_column('catalogue_fragment', '_short_html_ru') - - # Deleting field 'Fragment._short_html_es' - db.delete_column('catalogue_fragment', '_short_html_es') - - # Deleting field 'Fragment._short_html_uk' - db.delete_column('catalogue_fragment', '_short_html_uk') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] 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 deleted file mode 100644 index b990fc33f..000000000 --- a/apps/catalogue/migrations/0006_epub_tag_counters_and_ltags_descendants.py +++ /dev/null @@ -1,186 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -def get_ltag(book, orm): - ltag, created = orm.Tag.objects.get_or_create(slug='l-' + book.slug, category='book') - if created: - ltag.name = book.title - ltag.sort_key = ('l-' + book.slug)[:120] - ltag.save() - return ltag - - -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')(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): - if ltags is None: - ltags = [] - for tag in ltags: - orm.TagRelation(object_id=book.pk, tag=tag, content_type=book_ct).save() - print book, tag - 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') - except: - return - # remove all l-tags on books - 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. """ - - # Deleting fields - db.delete_column('catalogue_book', '_tag_counter') - db.delete_column('catalogue_book', '_theme_counter') - db.delete_column('catalogue_book', 'epub_file') - - if not db.dry_run: - try: - book_ct = orm['contenttypes.contenttype'].objects.get(app_label='catalogue', model='book') - except: - return - # remove all l-tags on books - 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'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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', [], {'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'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0007_remove_empty_html.py b/apps/catalogue/migrations/0007_remove_empty_html.py deleted file mode 100644 index 5b6f45393..000000000 --- a/apps/catalogue/migrations/0007_remove_empty_html.py +++ /dev/null @@ -1,146 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - """ Look for HTML files without any real content and delete them """ - from lxml import etree - 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)): - book.html_file.delete() - # must do it by hand, we don't see real Book.save - for key in filter(lambda x: x.startswith('_short_html'), book.__dict__): - book.__setattr__(key, '') - book.save() - - def backwards(self, orm): - """ Do nothing. We don't want empty HTML files anyway. """ - pass - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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', [], {'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'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0008_unique_tag_category_slug.py b/apps/catalogue/migrations/0008_unique_tag_category_slug.py deleted file mode 100644 index d13081959..000000000 --- a/apps/catalogue/migrations/0008_unique_tag_category_slug.py +++ /dev/null @@ -1,147 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Removing unique constraint on 'Tag', fields ['slug'] - db.delete_unique('catalogue_tag', ['slug']) - - # Adding unique constraint on 'Tag', fields ['category', 'slug'] - db.create_unique('catalogue_tag', ['category', 'slug']) - - - def backwards(self, orm): - - # Adding unique constraint on 'Tag', fields ['slug'] - db.create_unique('catalogue_tag', ['slug']) - - # Removing unique constraint on 'Tag', fields ['category', 'slug'] - db.delete_unique('catalogue_tag', ['category', 'slug']) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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', [], {'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'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0009_chg_book_count__heavy_cleaning.py b/apps/catalogue/migrations/0009_chg_book_count__heavy_cleaning.py deleted file mode 100644 index ed4f2b370..000000000 --- a/apps/catalogue/migrations/0009_chg_book_count__heavy_cleaning.py +++ /dev/null @@ -1,226 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Changing field 'Tag.book_count' - db.alter_column('catalogue_tag', 'book_count', self.gf('django.db.models.fields.IntegerField')(null=True)) - - if not db.dry_run: - from django.contrib.contenttypes.models import ContentType - from django.utils.simplejson import loads, dumps - - manager = orm.TagRelation.objects - - def type_id(model): - return ContentType.objects.get_for_model(model).pk - - def tagged_with_any(model, tags): - object_ids = {} - for relation in manager.filter(content_type=type_id(model), tag__in=tags): - object_ids[relation.object_id] = 1 - return model.objects.filter(pk__in=object_ids.keys()) - - def get_tags(instance): - return [relation.tag for relation in manager.filter( - content_type=type_id(type(instance)), object_id=instance.pk).select_related()] - - def refresh_book_count(tag): - if tag.category == 'theme': - objects = tagged_with_any(orm.Fragment, [tag]).only() - else: - objects = tagged_with_any(orm.Book, [tag]).only('slug') - if tag.category != 'set': - # eliminate descendants - l_tags = orm.Tag.objects.filter(slug__in=['l-'+book.slug for book in objects]) - descendants_keys = [book.pk for book in tagged_with_any(orm.Book, l_tags)] - if descendants_keys: - objects = objects.exclude(pk__in=descendants_keys) - tag.book_count = objects.count() - tag.save() - - def refresh_tag_counter(book): - tags = {} - for child in book.children.all().order_by(): - for tag_pk, value in tag_counter(child).iteritems(): - tags[tag_pk] = tags.get(tag_pk, 0) + value - for tag in [tag for tag in get_tags(book) if tag.category not in ('book', 'theme', 'set')]: - tags[tag.pk] = 1 - book._tag_counter = dumps(tags) - book.save() - return tags - - def tag_counter(book): - if book._tag_counter is None: - return refresh_tag_counter(book) - return dict((int(k), v) for k, v in loads(book._tag_counter).iteritems()) - - def theme_counter(book): - if book._theme_counter is None: - tags = {} - l_tag = orm.Tag.objects.get(slug='l-'+book.slug) - for fragment in tagged_with_any(orm.Fragment, [l_tag]): - for tag in [tag for tag in get_tags(fragment) if tag.category=='theme']: - tags[tag.pk] = tags.get(tag.pk, 0) + 1 - book._theme_counter = dumps(tags) - book.save() - - - # remove orphaned relations - book_type_id = type_id(orm.Book) - book_ids = [b.pk for b in orm.Book.objects.all().only()] - manager.filter(content_type=book_type_id).exclude(object_id__in=book_ids).delete() - del book_ids - - fragment_type_id = type_id(orm.Fragment) - fragment_ids = [b.pk for b in orm.Fragment.objects.all().only()] - manager.filter(content_type=fragment_type_id).exclude(object_id__in=fragment_ids).delete() - del fragment_ids - - tag_ids = [t.pk for t in orm.Tag.objects.all().only()] - manager.exclude(tag__in=tag_ids).delete() - del tag_ids - - # remove theme tags for books - manager.filter(content_type=book_type_id).filter(tag__category='theme').delete() - - # reset count fields - for tag in orm.Tag.objects.exclude(category__in=('book', 'set')).iterator(): - refresh_book_count(tag) - for book in orm.Book.objects.all().iterator(): - theme_counter(book) - for book in orm.Book.objects.filter(parent=None).iterator(): - tag_counter(book) - - def backwards(self, orm): - - # Changing field 'Tag.book_count' - db.alter_column('catalogue_tag', 'book_count', self.gf('django.db.models.fields.IntegerField')()) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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', [], {'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'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/migrations/0010_auto__add_filerecord.py b/apps/catalogue/migrations/0010_auto__add_filerecord.py deleted file mode 100644 index f072365f8..000000000 --- a/apps/catalogue/migrations/0010_auto__add_filerecord.py +++ /dev/null @@ -1,156 +0,0 @@ -# encoding: utf-8 -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -class Migration(SchemaMigration): - - def forwards(self, orm): - - # Adding model 'FileRecord' - db.create_table('catalogue_filerecord', ( - ('time', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), - ('sha1', self.gf('django.db.models.fields.CharField')(max_length=40)), - ('type', self.gf('django.db.models.fields.CharField')(max_length=20, db_index=True)), - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('slug', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)), - )) - db.send_create_signal('catalogue', ['FileRecord']) - - - def backwards(self, orm): - - # Deleting model 'FileRecord' - db.delete_table('catalogue_filerecord') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'blank': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'blank': 'True'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'catalogue.book': { - 'Meta': {'object_name': 'Book'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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', [], {'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'}), - 'extra_info': ('catalogue.fields.JSONField', [], {}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'mp3_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'odt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'ogg_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}), - 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}), - 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}) - }, - 'catalogue.bookstub': { - 'Meta': {'object_name': 'BookStub'}, - 'author': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'pd': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}), - 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'translator': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'translator_death': ('django.db.models.fields.TextField', [], {'blank': 'True'}) - }, - 'catalogue.filerecord': { - 'Meta': {'object_name': 'FileRecord'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - 'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}) - }, - 'catalogue.fragment': { - 'Meta': {'object_name': 'Fragment'}, - '_short_html': ('django.db.models.fields.TextField', [], {}), - '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}), - '_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}), - 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}), - 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'short_text': ('django.db.models.fields.TextField', [], {}), - 'text': ('django.db.models.fields.TextField', [], {}) - }, - 'catalogue.tag': { - 'Meta': {'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'}, - 'book_count': ('django.db.models.fields.IntegerField', [], {'null': 'True'}), - 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'death': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}), - 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'sort_key': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}), - 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}), - 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}) - }, - 'catalogue.tagrelation': { - 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"}, - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"}) - }, - 'contenttypes.contenttype': { - 'Meta': {'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - } - } - - complete_apps = ['catalogue'] diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 79faca7a4..d74ca7544 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -326,7 +326,7 @@ def _sqlite_word_starts_with(name, prefix): return Q(**kwargs) -if settings.DATABASE_ENGINE == 'sqlite3': +if settings.DATABASES['default']['ENGINE'] == 'django.db.backends.sqlite3': _word_starts_with = _sqlite_word_starts_with diff --git a/apps/newtagging/models.py b/apps/newtagging/models.py index ea2a41f8e..e9b114145 100644 --- a/apps/newtagging/models.py +++ b/apps/newtagging/models.py @@ -215,8 +215,18 @@ class TagManager(models.Manager): if parse_lookup: raise AttributeError("'TagManager.usage_for_queryset' is not compatible with pre-queryset-refactor versions of Django.") - extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:]) - where, params = queryset.query.where.as_sql() + if getattr(queryset.query, 'get_compiler', None): + # Django 1.2+ + compiler = queryset.query.get_compiler(using='default') + extra_joins = ' '.join(compiler.get_from_clause()[0][1:]) + where, params = queryset.query.where.as_sql( + compiler.quote_name_unless_alias, compiler.connection + ) + else: + # Django pre-1.2 + extra_joins = ' '.join(queryset.query.get_from_clause()[0][1:]) + where, params = queryset.query.where.as_sql() + if where: extra_criteria = 'AND %s' % where else: diff --git a/apps/sponsors/fields.py b/apps/sponsors/fields.py index c2098ec97..ba980816f 100644 --- a/apps/sponsors/fields.py +++ b/apps/sponsors/fields.py @@ -47,7 +47,7 @@ class JSONField(models.TextField): defaults.update(kwargs) return super(JSONField, self).formfield(**defaults) - def db_type(self): + def db_type(self, connection): return 'text' def get_internal_type(self): diff --git a/requirements.txt b/requirements.txt index 62485f381..abe5b7e70 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ --find-links=http://www.pythonware.com/products/pil/ # django -Django>=1.1.1,<1.2 +Django>=1.2 South>=0.7 # migrations for django django-pagination>=1.0 django-rosetta>=0.5.3 diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index b3f3c7827..0efb14531 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -14,12 +14,16 @@ ADMINS = [ MANAGERS = ADMINS -DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. -DATABASE_NAME = path.join(PROJECT_DIR, 'dev.db') # Or path to database file if using sqlite3. -DATABASE_USER = '' # Not used with sqlite3. -DATABASE_PASSWORD = '' # Not used with sqlite3. -DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. -DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. + 'NAME': path.join(PROJECT_DIR, 'dev.db'), # Or path to database file if using sqlite3. + 'USER': '', # Not used with sqlite3. + 'PASSWORD': '', # Not used with sqlite3. + 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. + 'PORT': '', # Set to empty string for default. Not used with sqlite3. + } +} # Local time zone for this installation. Choices can be found here: # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index 1a09a0ad5..a0b57b394 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -32,7 +32,7 @@ urlpatterns = patterns('', # Admin panel url(r'^admin/catalogue/book/import$', 'catalogue.views.import_book', name='import_book'), url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - url(r'^admin/(.*)$', admin.site.root), + url(r'^admin/', include(admin.site.urls)), # Authentication url(r'^uzytkownicy/zaloguj/$', 'catalogue.views.login', name='login'), -- 2.20.1