3 from south.db import db
4 from south.v2 import DataMigration
5 from django.db import models
7 from sortify import sortify
10 class Migration(DataMigration):
12 def forwards(self, orm):
13 "Write your forwards methods here."
15 for b in orm.Book.objects.all():
16 b.sort_key = sortify(b.title)
19 for t in orm.Tag.objects.all():
20 t.sort_key = sortify(t.sort_key)
24 def backwards(self, orm):
25 "Write your backwards methods here."
31 'Meta': {'object_name': 'Group'},
32 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
33 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
34 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
37 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
38 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
39 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
40 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
41 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
44 'Meta': {'object_name': 'User'},
45 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
46 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
47 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
48 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
49 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
50 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
51 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
52 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
53 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
54 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
55 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
56 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
57 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
60 'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
61 '_short_html': ('django.db.models.fields.TextField', [], {}),
62 '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
63 '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
64 '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
65 '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
66 '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
67 '_short_html_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
68 '_short_html_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
69 '_short_html_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
70 '_tag_counter': ('catalogue.fields.JSONField', [], {'null': 'True'}),
71 '_theme_counter': ('catalogue.fields.JSONField', [], {'null': 'True'}),
72 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
73 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
74 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
75 'epub_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
76 'extra_info': ('catalogue.fields.JSONField', [], {'default': "'{}'"}),
77 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
78 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
79 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
80 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
81 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
82 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
83 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}),
84 'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
85 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
86 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
87 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
88 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'})
90 'catalogue.bookmedia': {
91 'Meta': {'ordering': "('type', 'name')", 'object_name': 'BookMedia'},
92 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'media'", 'to': "orm['catalogue.Book']"}),
93 'extra_info': ('catalogue.fields.JSONField', [], {'default': "'{}'"}),
94 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
95 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
96 'name': ('django.db.models.fields.CharField', [], {'max_length': "'100'"}),
97 'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
98 'type': ('django.db.models.fields.CharField', [], {'max_length': "'100'"}),
99 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})
101 'catalogue.filerecord': {
102 'Meta': {'ordering': "('-time', '-slug', '-type')", 'object_name': 'FileRecord'},
103 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
104 'sha1': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
105 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}),
106 'time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
107 'type': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'})
109 'catalogue.fragment': {
110 'Meta': {'ordering': "('book', 'anchor')", 'object_name': 'Fragment'},
111 '_short_html': ('django.db.models.fields.TextField', [], {}),
112 '_short_html_de': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
113 '_short_html_en': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
114 '_short_html_es': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
115 '_short_html_fr': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
116 '_short_html_lt': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
117 '_short_html_pl': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
118 '_short_html_ru': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
119 '_short_html_uk': ('django.db.models.fields.TextField', [], {'null': True, 'blank': True}),
120 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
121 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}),
122 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
123 'short_text': ('django.db.models.fields.TextField', [], {}),
124 'text': ('django.db.models.fields.TextField', [], {})
127 'Meta': {'ordering': "('sort_key',)", 'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'},
128 'book_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
129 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
130 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
131 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
132 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
133 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
134 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
135 'main_page': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}),
136 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
137 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}),
138 'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
139 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
140 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'})
142 'catalogue.tagrelation': {
143 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"},
144 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
145 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
146 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
147 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"})
149 'contenttypes.contenttype': {
150 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
151 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
152 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
153 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
154 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
158 complete_apps = ['catalogue']