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):
11 # Adding model 'Result'
12 db.create_table('quiz_result', (
13 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
14 ('quiz', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'])),
15 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
16 ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
17 ('text', self.gf('django.db.models.fields.TextField')()),
19 db.send_create_signal('quiz', ['Result'])
21 # Adding model 'Question'
22 db.create_table('quiz_question', (
23 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
24 ('quiz', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['sites.Site'])),
25 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
26 ('ordering', self.gf('django.db.models.fields.SmallIntegerField')()),
27 ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
28 ('text', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
29 ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
31 db.send_create_signal('quiz', ['Question'])
33 # Adding unique constraint on 'Question', fields ['quiz', 'slug']
34 db.create_unique('quiz_question', ['quiz_id', 'slug'])
36 # Adding unique constraint on 'Question', fields ['quiz', 'ordering']
37 db.create_unique('quiz_question', ['quiz_id', 'ordering'])
39 # Adding model 'Answer'
40 db.create_table('quiz_answer', (
41 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
42 ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
43 ('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Question'])),
44 ('go_to', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='go_tos', null=True, to=orm['quiz.Question'])),
45 ('result', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Result'], null=True, blank=True)),
46 ('ordering', self.gf('django.db.models.fields.SmallIntegerField')()),
48 db.send_create_signal('quiz', ['Answer'])
51 def backwards(self, orm):
53 # Removing unique constraint on 'Question', fields ['quiz', 'ordering']
54 db.delete_unique('quiz_question', ['quiz_id', 'ordering'])
56 # Removing unique constraint on 'Question', fields ['quiz', 'slug']
57 db.delete_unique('quiz_question', ['quiz_id', 'slug'])
59 # Deleting model 'Result'
60 db.delete_table('quiz_result')
62 # Deleting model 'Question'
63 db.delete_table('quiz_question')
65 # Deleting model 'Answer'
66 db.delete_table('quiz_answer')
71 'Meta': {'ordering': "['question', 'ordering']", 'object_name': 'Answer'},
72 'go_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'go_tos'", 'null': 'True', 'to': "orm['quiz.Question']"}),
73 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
74 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
75 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Question']"}),
76 'result': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Result']", 'null': 'True', 'blank': 'True'}),
77 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
80 'Meta': {'ordering': "['quiz', 'ordering']", 'unique_together': "[['quiz', 'slug'], ['quiz', 'ordering']]", 'object_name': 'Question'},
81 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
82 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
83 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
84 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
85 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
86 'text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
87 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
90 'Meta': {'ordering': "('domain',)", 'object_name': 'Quiz', 'db_table': "'django_site'", '_ormbases': ['sites.Site'], 'proxy': 'True'}
93 'Meta': {'object_name': 'Result'},
94 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
95 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
96 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
97 'text': ('django.db.models.fields.TextField', [], {}),
98 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
101 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
102 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
103 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
104 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
108 complete_apps = ['quiz']