1 # -*- coding: utf-8 -*-
3 from south.db import db
4 from south.v2 import SchemaMigration
5 from django.db import models
8 class Migration(SchemaMigration):
10 def forwards(self, orm):
11 # Adding model 'ImagePublishRecord'
12 db.create_table(u'catalogue_imagepublishrecord', (
13 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('image', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.Image'])),
15 ('timestamp', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)),
16 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
17 ('change', self.gf('django.db.models.fields.related.ForeignKey')(related_name='publish_log', to=orm['catalogue.ImageChange'])),
19 db.send_create_signal('catalogue', ['ImagePublishRecord'])
21 # Adding model 'ImageChange'
22 db.create_table(u'catalogue_imagechange', (
23 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
24 ('author', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
25 ('author_name', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
26 ('author_email', self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True)),
27 ('revision', self.gf('django.db.models.fields.IntegerField')(db_index=True)),
28 ('parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='children', null=True, blank=True, to=orm['catalogue.ImageChange'])),
29 ('merge_parent', self.gf('django.db.models.fields.related.ForeignKey')(default=None, related_name='merge_children', null=True, blank=True, to=orm['catalogue.ImageChange'])),
30 ('description', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
31 ('created_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now, db_index=True)),
32 ('publishable', self.gf('django.db.models.fields.BooleanField')(default=False)),
33 ('tree', self.gf('django.db.models.fields.related.ForeignKey')(related_name='change_set', to=orm['catalogue.Image'])),
34 ('data', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
36 db.send_create_signal('catalogue', ['ImageChange'])
38 # Adding M2M table for field tags on 'ImageChange'
39 db.create_table(u'catalogue_imagechange_tags', (
40 ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
41 ('imagechange', models.ForeignKey(orm['catalogue.imagechange'], null=False)),
42 ('imagetag', models.ForeignKey(orm['catalogue.imagetag'], null=False))
44 db.create_unique(u'catalogue_imagechange_tags', ['imagechange_id', 'imagetag_id'])
46 # Adding unique constraint on 'ImageChange', fields ['tree', 'revision']
47 db.create_unique(u'catalogue_imagechange', ['tree_id', 'revision'])
49 # Adding model 'ImageTag'
50 db.create_table(u'catalogue_imagetag', (
51 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
52 ('name', self.gf('django.db.models.fields.CharField')(max_length=64)),
53 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=64, unique=True, null=True, blank=True)),
54 ('ordering', self.gf('django.db.models.fields.IntegerField')()),
56 db.send_create_signal('catalogue', ['ImageTag'])
58 # Adding model 'Image'
59 db.create_table(u'catalogue_image', (
60 (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
61 ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'], null=True, blank=True)),
62 ('image', self.gf('django.db.models.fields.files.FileField')(max_length=100)),
63 ('title', self.gf('django.db.models.fields.CharField')(max_length=255, blank=True)),
64 ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50)),
65 ('public', self.gf('django.db.models.fields.BooleanField')(default=True, db_index=True)),
66 ('_short_html', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
67 ('_new_publishable', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
68 ('_published', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
69 ('_changed', self.gf('django.db.models.fields.NullBooleanField')(null=True, blank=True)),
70 ('stage', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.ImageTag'], null=True, blank=True)),
71 ('head', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['catalogue.ImageChange'], null=True, blank=True)),
72 ('creator', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='created_image', null=True, to=orm['auth.User'])),
74 db.send_create_signal('catalogue', ['Image'])
77 def backwards(self, orm):
78 # Removing unique constraint on 'ImageChange', fields ['tree', 'revision']
79 db.delete_unique(u'catalogue_imagechange', ['tree_id', 'revision'])
81 # Deleting model 'ImagePublishRecord'
82 db.delete_table(u'catalogue_imagepublishrecord')
84 # Deleting model 'ImageChange'
85 db.delete_table(u'catalogue_imagechange')
87 # Removing M2M table for field tags on 'ImageChange'
88 db.delete_table('catalogue_imagechange_tags')
90 # Deleting model 'ImageTag'
91 db.delete_table(u'catalogue_imagetag')
93 # Deleting model 'Image'
94 db.delete_table(u'catalogue_image')
99 'Meta': {'object_name': 'Group'},
100 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
101 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
102 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
104 u'auth.permission': {
105 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'},
106 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
107 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}),
108 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
109 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
112 'Meta': {'object_name': 'User'},
113 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
114 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
115 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
116 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
117 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
118 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
119 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
120 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
121 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
122 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
123 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
124 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
125 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
128 'Meta': {'ordering': "['title', 'slug']", 'object_name': 'Book'},
129 '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
130 '_on_track': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
131 '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
132 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
133 '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
134 'dc_cover_image': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['cover.Image']", 'null': 'True', 'on_delete': 'models.SET_NULL', 'blank': 'True'}),
135 'dc_slug': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '128', 'null': 'True', 'blank': 'True'}),
136 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
137 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
138 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
139 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
140 'project': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Project']", 'null': 'True', 'blank': 'True'}),
141 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
142 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128'}),
143 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
145 'catalogue.bookpublishrecord': {
146 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'},
147 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}),
148 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
149 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
150 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
153 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'},
154 '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
155 '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
156 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
157 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
158 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': u"orm['auth.User']"}),
159 'gallery_start': ('django.db.models.fields.IntegerField', [], {'default': '1', 'null': 'True', 'blank': 'True'}),
160 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}),
161 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
162 'number': ('django.db.models.fields.IntegerField', [], {}),
163 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
164 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}),
165 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
166 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'})
168 'catalogue.chunkchange': {
169 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'},
170 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}),
171 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
172 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
173 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
174 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
175 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
176 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
177 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
178 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
179 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
180 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
181 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}),
182 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"})
184 'catalogue.chunkpublishrecord': {
185 'Meta': {'object_name': 'ChunkPublishRecord'},
186 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}),
187 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}),
188 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
190 'catalogue.chunktag': {
191 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'},
192 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
193 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
194 'ordering': ('django.db.models.fields.IntegerField', [], {}),
195 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'})
198 'Meta': {'ordering': "['title']", 'object_name': 'Image'},
199 '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
200 '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
201 '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
202 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
203 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_image'", 'null': 'True', 'to': u"orm['auth.User']"}),
204 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ImageChange']", 'null': 'True', 'blank': 'True'}),
205 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
206 'image': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
207 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}),
208 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50'}),
209 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ImageTag']", 'null': 'True', 'blank': 'True'}),
210 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
211 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'})
213 'catalogue.imagechange': {
214 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ImageChange'},
215 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']", 'null': 'True', 'blank': 'True'}),
216 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
217 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
218 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
219 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
220 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
221 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
222 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ImageChange']"}),
223 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ImageChange']"}),
224 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
225 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
226 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ImageTag']"}),
227 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Image']"})
229 'catalogue.imagepublishrecord': {
230 'Meta': {'ordering': "['-timestamp']", 'object_name': 'ImagePublishRecord'},
231 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ImageChange']"}),
232 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
233 'image': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Image']"}),
234 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
235 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['auth.User']"})
237 'catalogue.imagetag': {
238 'Meta': {'ordering': "['ordering']", 'object_name': 'ImageTag'},
239 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
240 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
241 'ordering': ('django.db.models.fields.IntegerField', [], {}),
242 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'})
244 'catalogue.project': {
245 'Meta': {'ordering': "['name']", 'object_name': 'Project'},
246 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
247 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '255'}),
248 'notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'})
250 u'contenttypes.contenttype': {
251 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
252 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
253 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
254 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
255 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
258 'Meta': {'object_name': 'Image'},
259 'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
260 'download_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'unique': 'True', 'null': 'True', 'blank': 'True'}),
261 'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
262 u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
263 'license_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
264 'license_url': ('django.db.models.fields.URLField', [], {'max_length': '255', 'blank': 'True'}),
265 'source_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
266 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
270 complete_apps = ['catalogue']