3 from south.db import db
4 from south.v2 import SchemaMigration
5 from django.db import models
7 class Migration(SchemaMigration):
9 def forwards(self, orm):
12 db.create_table('catalogue_tag', (
13 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('name', self.gf('django.db.models.fields.CharField')(max_length=50, db_index=True)),
15 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)),
16 ('sort_key', self.gf('django.db.models.fields.CharField')(max_length=120, db_index=True)),
17 ('category', self.gf('django.db.models.fields.CharField')(max_length=50, db_index=True)),
18 ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
19 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
20 ('book_count', self.gf('django.db.models.fields.IntegerField')(null=True, blank=True)),
21 ('gazeta_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)),
22 ('wiki_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)),
23 ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, db_index=True, blank=True)),
24 ('changed_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, db_index=True, blank=True)),
26 db.send_create_signal('catalogue', ['Tag'])
28 # Adding unique constraint on 'Tag', fields ['slug', 'category']
29 db.create_unique('catalogue_tag', ['slug', 'category'])
31 # Adding model 'TagRelation'
32 db.create_table('catalogue_tag_relation', (
33 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
34 ('tag', self.gf('django.db.models.fields.related.ForeignKey')(related_name='items', to=orm['catalogue.Tag'])),
35 ('content_type', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['contenttypes.ContentType'])),
36 ('object_id', self.gf('django.db.models.fields.PositiveIntegerField')(db_index=True)),
38 db.send_create_signal('catalogue', ['TagRelation'])
40 # Adding unique constraint on 'TagRelation', fields ['tag', 'content_type', 'object_id']
41 db.create_unique('catalogue_tag_relation', ['tag_id', 'content_type_id', 'object_id'])
43 # Adding model 'BookMedia'
44 db.create_table('catalogue_bookmedia', (
45 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
46 ('type', self.gf('django.db.models.fields.CharField')(max_length='100')),
47 ('name', self.gf('django.db.models.fields.CharField')(max_length='100')),
48 ('file', self.gf('catalogue.fields.OverwritingFileField')(max_length=100)),
49 ('uploaded_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
50 ('extra_info', self.gf('jsonfield.fields.JSONField')(default='{}')),
51 ('book', self.gf('django.db.models.fields.related.ForeignKey')(related_name='media', to=orm['catalogue.Book'])),
52 ('source_sha1', self.gf('django.db.models.fields.CharField')(max_length=40, null=True, blank=True)),
54 db.send_create_signal('catalogue', ['BookMedia'])
57 db.create_table('catalogue_book', (
58 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
59 ('title', self.gf('django.db.models.fields.CharField')(max_length=120)),
60 ('sort_key', self.gf('django.db.models.fields.CharField')(max_length=120, db_index=True)),
61 ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=120, db_index=True)),
62 ('common_slug', self.gf('django.db.models.fields.SlugField')(max_length=120, db_index=True)),
63 ('language', self.gf('django.db.models.fields.CharField')(default='pol', max_length=3, db_index=True)),
64 ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
65 ('created_at', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, db_index=True, blank=True)),
66 ('changed_at', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, db_index=True, blank=True)),
67 ('parent_number', self.gf('django.db.models.fields.IntegerField')(default=0)),
68 ('extra_info', self.gf('jsonfield.fields.JSONField')(default='{}')),
69 ('gazeta_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)),
70 ('wiki_link', self.gf('django.db.models.fields.CharField')(max_length=240, blank=True)),
71 ('cover', self.gf('django.db.models.fields.files.FileField')(max_length=100, null=True, blank=True)),
72 ('parent', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='children', null=True, to=orm['catalogue.Book'])),
73 ('_related_info', self.gf('jsonfield.fields.JSONField')(null=True, blank=True)),
74 ('pdf_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)),
75 ('epub_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)),
76 ('mobi_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)),
77 ('txt_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)),
78 ('html_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)),
79 ('xml_file', self.gf('django.db.models.fields.files.FileField')(max_length=100, blank=True)),
81 db.send_create_signal('catalogue', ['Book'])
83 # Adding model 'Fragment'
84 db.create_table('catalogue_fragment', (
85 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
86 ('text', self.gf('django.db.models.fields.TextField')()),
87 ('short_text', self.gf('django.db.models.fields.TextField')()),
88 ('anchor', self.gf('django.db.models.fields.CharField')(max_length=120)),
89 ('book', self.gf('django.db.models.fields.related.ForeignKey')(related_name='fragments', to=orm['catalogue.Book'])),
91 db.send_create_signal('catalogue', ['Fragment'])
93 # Adding model 'Collection'
94 db.create_table('catalogue_collection', (
95 ('title', self.gf('django.db.models.fields.CharField')(max_length=120, db_index=True)),
96 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=120, primary_key=True, db_index=True)),
97 ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
98 ('book_slugs', self.gf('django.db.models.fields.TextField')()),
100 db.send_create_signal('catalogue', ['Collection'])
103 def backwards(self, orm):
105 # Removing unique constraint on 'TagRelation', fields ['tag', 'content_type', 'object_id']
106 db.delete_unique('catalogue_tag_relation', ['tag_id', 'content_type_id', 'object_id'])
108 # Removing unique constraint on 'Tag', fields ['slug', 'category']
109 db.delete_unique('catalogue_tag', ['slug', 'category'])
111 # Deleting model 'Tag'
112 db.delete_table('catalogue_tag')
114 # Deleting model 'TagRelation'
115 db.delete_table('catalogue_tag_relation')
117 # Deleting model 'BookMedia'
118 db.delete_table('catalogue_bookmedia')
120 # Deleting model 'Book'
121 db.delete_table('catalogue_book')
123 # Deleting model 'Fragment'
124 db.delete_table('catalogue_fragment')
126 # Deleting model 'Collection'
127 db.delete_table('catalogue_collection')
132 'Meta': {'object_name': 'Group'},
133 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
134 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
135 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
138 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
139 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
140 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
141 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
142 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
145 'Meta': {'object_name': 'User'},
146 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
147 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
148 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
149 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
150 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
151 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
152 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
153 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
154 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
155 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
156 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
157 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
158 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
161 'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
162 '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
163 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
164 'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}),
165 'cover': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
166 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
167 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
168 'epub_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
169 'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
170 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
171 'html_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
172 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
173 'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
174 'mobi_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
175 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
176 'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
177 'pdf_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
178 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120', 'db_index': 'True'}),
179 'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
180 'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
181 'txt_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'}),
182 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
183 'xml_file': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'blank': 'True'})
185 'catalogue.bookmedia': {
186 'Meta': {'ordering': "('type', 'name')", 'object_name': 'BookMedia'},
187 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'media'", 'to': "orm['catalogue.Book']"}),
188 'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
189 'file': ('catalogue.fields.OverwritingFileField', [], {'max_length': '100'}),
190 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
191 'name': ('django.db.models.fields.CharField', [], {'max_length': "'100'"}),
192 'source_sha1': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
193 'type': ('django.db.models.fields.CharField', [], {'max_length': "'100'"}),
194 'uploaded_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'})
196 'catalogue.collection': {
197 'Meta': {'ordering': "('title',)", 'object_name': 'Collection'},
198 'book_slugs': ('django.db.models.fields.TextField', [], {}),
199 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
200 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'primary_key': 'True', 'db_index': 'True'}),
201 'title': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'})
203 'catalogue.fragment': {
204 'Meta': {'ordering': "('book', 'anchor')", 'object_name': 'Fragment'},
205 'anchor': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
206 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fragments'", 'to': "orm['catalogue.Book']"}),
207 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
208 'short_text': ('django.db.models.fields.TextField', [], {}),
209 'text': ('django.db.models.fields.TextField', [], {})
212 'Meta': {'ordering': "('sort_key',)", 'unique_together': "(('slug', 'category'),)", 'object_name': 'Tag'},
213 'book_count': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
214 'category': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
215 'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
216 'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
217 'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
218 'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
219 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
220 'name': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}),
221 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '120', 'db_index': 'True'}),
222 'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
223 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
224 'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'})
226 'catalogue.tagrelation': {
227 'Meta': {'unique_together': "(('tag', 'content_type', 'object_id'),)", 'object_name': 'TagRelation', 'db_table': "'catalogue_tag_relation'"},
228 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
229 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
230 'object_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}),
231 'tag': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['catalogue.Tag']"})
233 'contenttypes.contenttype': {
234 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
235 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
236 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
237 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
238 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
242 complete_apps = ['catalogue']