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 "Make sure all revisions start with 1, not 0."
11 for zero_commit in orm.ChunkChange.objects.filter(revision=0):
12 for change in zero_commit.tree.change_set.all().order_by('-revision'):
13 change.revision=models.F('revision') + 1
17 def backwards(self, orm):
18 "Write your backwards methods here."
24 'Meta': {'object_name': 'Group'},
25 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
26 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
27 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
30 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
31 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
32 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
33 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
34 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
37 'Meta': {'object_name': 'User'},
38 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
39 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
40 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
41 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
42 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
43 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
44 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
45 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
46 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
47 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
48 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
49 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
50 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
53 'Meta': {'ordering': "['parent_number', 'title']", 'object_name': 'Book'},
54 '_new_publishable': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
55 '_published': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
56 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
57 '_single': ('django.db.models.fields.NullBooleanField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
58 'gallery': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
59 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
60 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
61 'parent_number': ('django.db.models.fields.IntegerField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
62 'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '128', 'db_index': 'True'}),
63 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
65 'catalogue.bookpublishrecord': {
66 'Meta': {'ordering': "['-timestamp']", 'object_name': 'BookPublishRecord'},
67 'book': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.Book']"}),
68 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
69 'timestamp': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
70 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
73 'Meta': {'ordering': "['number']", 'unique_together': "[['book', 'number'], ['book', 'slug']]", 'object_name': 'Chunk'},
74 '_changed': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
75 '_hidden': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
76 '_short_html': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
77 'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
78 'creator': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'created_chunk'", 'null': 'True', 'to': "orm['auth.User']"}),
79 'head': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['catalogue.ChunkChange']", 'null': 'True', 'blank': 'True'}),
80 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
81 'number': ('django.db.models.fields.IntegerField', [], {}),
82 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
83 'stage': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.ChunkTag']", 'null': 'True', 'blank': 'True'}),
84 'title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'blank': 'True'}),
85 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
87 'catalogue.chunkchange': {
88 'Meta': {'ordering': "('created_at',)", 'unique_together': "(['tree', 'revision'],)", 'object_name': 'ChunkChange'},
89 'author': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'}),
90 'author_email': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
91 'author_name': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
92 'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True'}),
93 'data': ('django.db.models.fields.files.FileField', [], {'max_length': '100'}),
94 'description': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
95 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
96 'merge_parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'merge_children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
97 'parent': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'related_name': "'children'", 'null': 'True', 'blank': 'True', 'to': "orm['catalogue.ChunkChange']"}),
98 'publishable': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
99 'revision': ('django.db.models.fields.IntegerField', [], {'db_index': 'True'}),
100 'tags': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'change_set'", 'symmetrical': 'False', 'to': "orm['catalogue.ChunkTag']"}),
101 'tree': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'change_set'", 'to': "orm['catalogue.Chunk']"})
103 'catalogue.chunkpublishrecord': {
104 'Meta': {'object_name': 'ChunkPublishRecord'},
105 'book_record': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.BookPublishRecord']"}),
106 'change': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'publish_log'", 'to': "orm['catalogue.ChunkChange']"}),
107 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
109 'catalogue.chunktag': {
110 'Meta': {'ordering': "['ordering']", 'object_name': 'ChunkTag'},
111 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
112 'name': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
113 'ordering': ('django.db.models.fields.IntegerField', [], {}),
114 'slug': ('django.db.models.fields.SlugField', [], {'db_index': 'True', 'max_length': '64', 'unique': 'True', 'null': 'True', 'blank': 'True'})
116 'contenttypes.contenttype': {
117 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
118 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
119 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
120 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
121 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
125 complete_apps = ['catalogue']