-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Adding model 'Quiz'
- db.create_table('quiz_quiz', (
- ('site_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['sites.Site'], unique=True, primary_key=True)),
- ('description', self.gf('django.db.models.fields.TextField')()),
- ))
- db.send_create_signal('quiz', ['Quiz'])
-
- # Adding model 'Result'
- db.create_table('quiz_result', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('quiz', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Quiz'])),
- ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
- ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('text', self.gf('django.db.models.fields.TextField')()),
- ))
- db.send_create_signal('quiz', ['Result'])
-
- # Adding model 'Question'
- db.create_table('quiz_question', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('quiz', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Quiz'])),
- ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
- ('ordering', self.gf('django.db.models.fields.SmallIntegerField')()),
- ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('text', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)),
- ))
- db.send_create_signal('quiz', ['Question'])
-
- # Adding unique constraint on 'Question', fields ['quiz', 'slug']
- db.create_unique('quiz_question', ['quiz_id', 'slug'])
-
- # Adding unique constraint on 'Question', fields ['quiz', 'ordering']
- db.create_unique('quiz_question', ['quiz_id', 'ordering'])
-
- # Adding model 'Answer'
- db.create_table('quiz_answer', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
- ('question', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Question'])),
- ('go_to', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='go_tos', null=True, to=orm['quiz.Question'])),
- ('result', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['quiz.Result'], null=True, blank=True)),
- ('ordering', self.gf('django.db.models.fields.SmallIntegerField')()),
- ))
- db.send_create_signal('quiz', ['Answer'])
-
-
- def backwards(self, orm):
-
- # Removing unique constraint on 'Question', fields ['quiz', 'ordering']
- db.delete_unique('quiz_question', ['quiz_id', 'ordering'])
-
- # Removing unique constraint on 'Question', fields ['quiz', 'slug']
- db.delete_unique('quiz_question', ['quiz_id', 'slug'])
-
- # Deleting model 'Quiz'
- db.delete_table('quiz_quiz')
-
- # Deleting model 'Result'
- db.delete_table('quiz_result')
-
- # Deleting model 'Question'
- db.delete_table('quiz_question')
-
- # Deleting model 'Answer'
- db.delete_table('quiz_answer')
-
-
- models = {
- 'quiz.answer': {
- 'Meta': {'ordering': "['question', 'ordering']", 'object_name': 'Answer'},
- 'go_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'go_tos'", 'null': 'True', 'to': "orm['quiz.Question']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
- 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Question']"}),
- 'result': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Result']", 'null': 'True', 'blank': 'True'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
- },
- 'quiz.question': {
- 'Meta': {'ordering': "['quiz', 'ordering']", 'unique_together': "[['quiz', 'slug'], ['quiz', 'ordering']]", 'object_name': 'Question'},
- 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
- 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
- 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
- 'text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
- },
- 'quiz.quiz': {
- 'Meta': {'ordering': "('domain',)", 'object_name': 'Quiz', '_ormbases': ['sites.Site']},
- 'description': ('django.db.models.fields.TextField', [], {}),
- 'site_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sites.Site']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'quiz.result': {
- 'Meta': {'object_name': 'Result'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
- 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
- 'text': ('django.db.models.fields.TextField', [], {}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
- },
- 'sites.site': {
- 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
- 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- }
- }
-
- complete_apps = ['quiz']
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('sites', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Answer',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('title', models.CharField(max_length=255)),
+ ('ordering', models.SmallIntegerField()),
+ ],
+ options={
+ 'ordering': ['question', 'ordering'],
+ 'verbose_name': 'answer',
+ 'verbose_name_plural': 'answers',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.CreateModel(
+ name='Question',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('slug', models.SlugField()),
+ ('ordering', models.SmallIntegerField()),
+ ('title', models.CharField(max_length=255)),
+ ('text', models.TextField(null=True, blank=True)),
+ ('description', models.TextField(null=True, blank=True)),
+ ],
+ options={
+ 'ordering': ['quiz', 'ordering'],
+ 'verbose_name': 'question',
+ 'verbose_name_plural': 'questions',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.CreateModel(
+ name='Quiz',
+ fields=[
+ ('site_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='sites.Site')),
+ ('description', models.TextField()),
+ ('footer', models.TextField(null=True, blank=True)),
+ ],
+ options={
+ 'verbose_name': 'quiz',
+ 'verbose_name_plural': 'quizzes',
+ },
+ bases=('sites.site',),
+ ),
+ migrations.CreateModel(
+ name='Result',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('slug', models.SlugField()),
+ ('title', models.CharField(max_length=255)),
+ ('text', models.TextField()),
+ ('quiz', models.ForeignKey(to='quiz.Quiz')),
+ ],
+ options={
+ 'ordering': ['quiz', 'title'],
+ 'verbose_name': 'result',
+ 'verbose_name_plural': 'results',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.AddField(
+ model_name='question',
+ name='quiz',
+ field=models.ForeignKey(to='quiz.Quiz'),
+ preserve_default=True,
+ ),
+ migrations.AlterUniqueTogether(
+ name='question',
+ unique_together=set([('quiz', 'slug'), ('quiz', 'ordering')]),
+ ),
+ migrations.AddField(
+ model_name='answer',
+ name='go_to',
+ field=models.ForeignKey(related_name=b'go_tos', blank=True, to='quiz.Question', null=True),
+ preserve_default=True,
+ ),
+ migrations.AddField(
+ model_name='answer',
+ name='question',
+ field=models.ForeignKey(to='quiz.Question'),
+ preserve_default=True,
+ ),
+ migrations.AddField(
+ model_name='answer',
+ name='result',
+ field=models.ForeignKey(blank=True, to='quiz.Result', null=True),
+ preserve_default=True,
+ ),
+ ]
+++ /dev/null
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Adding field 'Quiz.footer'
- db.add_column('quiz_quiz', 'footer', self.gf('django.db.models.fields.TextField')(null=True, blank=True), keep_default=False)
-
-
- def backwards(self, orm):
-
- # Deleting field 'Quiz.footer'
- db.delete_column('quiz_quiz', 'footer')
-
-
- models = {
- 'quiz.answer': {
- 'Meta': {'ordering': "['question', 'ordering']", 'object_name': 'Answer'},
- 'go_to': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'go_tos'", 'null': 'True', 'to': "orm['quiz.Question']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
- 'question': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Question']"}),
- 'result': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Result']", 'null': 'True', 'blank': 'True'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
- },
- 'quiz.question': {
- 'Meta': {'ordering': "['quiz', 'ordering']", 'unique_together': "[['quiz', 'slug'], ['quiz', 'ordering']]", 'object_name': 'Question'},
- 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ordering': ('django.db.models.fields.SmallIntegerField', [], {}),
- 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
- 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
- 'text': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
- },
- 'quiz.quiz': {
- 'Meta': {'ordering': "('domain',)", 'object_name': 'Quiz', '_ormbases': ['sites.Site']},
- 'description': ('django.db.models.fields.TextField', [], {}),
- 'footer': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
- 'site_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['sites.Site']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'quiz.result': {
- 'Meta': {'ordering': "['quiz', 'title']", 'object_name': 'Result'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'quiz': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['quiz.Quiz']"}),
- 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'}),
- 'text': ('django.db.models.fields.TextField', [], {}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
- },
- 'sites.site': {
- 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
- 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- }
- }
-
- complete_apps = ['quiz']