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