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('quiz_quiz', (
13 ('site_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['sites.Site'], unique=True, primary_key=True)),
14 ('description', self.gf('django.db.models.fields.TextField')()),
16 db.send_create_signal('quiz', ['Quiz'])
18 # Adding model 'Result'
19 db.create_table('quiz_result', (
20 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
21 ('quiz', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Quiz'])),
22 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
23 ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
24 ('text', self.gf('django.db.models.fields.TextField')()),
26 db.send_create_signal('quiz', ['Result'])
28 # Adding model 'Question'
29 db.create_table('quiz_question', (
30 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
31 ('quiz', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Quiz'])),
32 ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
33 ('ordering', self.gf('django.db.models.fields.SmallIntegerField')()),
34 ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
35 ('text', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
36 ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
38 db.send_create_signal('quiz', ['Question'])
40 # Adding unique constraint on 'Question', fields ['quiz', 'slug']
41 db.create_unique('quiz_question', ['quiz_id', 'slug'])
43 # Adding unique constraint on 'Question', fields ['quiz', 'ordering']
44 db.create_unique('quiz_question', ['quiz_id', 'ordering'])
46 # Adding model 'Answer'
47 db.create_table('quiz_answer', (
48 ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
49 ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
50 ('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Question'])),
51 ('go_to', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='go_tos', null=True, to=orm['quiz.Question'])),
52 ('result', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Result'], null=True, blank=True)),
53 ('ordering', self.gf('django.db.models.fields.SmallIntegerField')()),
55 db.send_create_signal('quiz', ['Answer'])
58 def backwards(self, orm):
60 # Removing unique constraint on 'Question', fields ['quiz', 'ordering']
61 db.delete_unique('quiz_question', ['quiz_id', 'ordering'])
63 # Removing unique constraint on 'Question', fields ['quiz', 'slug']
64 db.delete_unique('quiz_question', ['quiz_id', 'slug'])
66 # Deleting model 'Quiz'
67 db.delete_table('quiz_quiz')
69 # Deleting model 'Result'
70 db.delete_table('quiz_result')
72 # Deleting model 'Question'
73 db.delete_table('quiz_question')
75 # Deleting model 'Answer'
76 db.delete_table('quiz_answer')
81 'Meta': {'ordering': "['question', 'ordering']", 'object_name': 'Answer'},
82 'go_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'go_tos'", 'null': 'True', 'to': "orm['quiz.Question']"}),
83 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
84 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
85 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Question']"}),
86 'result': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Result']", 'null': 'True', 'blank': 'True'}),
87 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
90 'Meta': {'ordering': "['quiz', 'ordering']", 'unique_together': "[['quiz', 'slug'], ['quiz', 'ordering']]", 'object_name': 'Question'},
91 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
92 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
93 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
94 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
95 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
96 'text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
97 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
100 'Meta': {'ordering': "('domain',)", 'object_name': 'Quiz', '_ormbases': ['sites.Site']},
101 'description': ('django.db.models.fields.TextField', [], {}),
102 'site_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sites.Site']", 'unique': 'True', 'primary_key': 'True'})
105 'Meta': {'object_name': 'Result'},
106 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
107 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
108 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
109 'text': ('django.db.models.fields.TextField', [], {}),
110 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
113 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
114 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
115 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
116 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
120 complete_apps = ['quiz']