- # 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 '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['sites.Site']"}),
- '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', 'db_table': "'django_site'", '_ormbases': ['sites.Site'], 'proxy': '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['sites.Site']"}),
- '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']
+ 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', on_delete=models.CASCADE)),
+ ('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', on_delete=models.CASCADE)),
+ ],
+ 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', on_delete=models.CASCADE),
+ 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='go_tos', blank=True, to='quiz.Question', null=True, on_delete=models.CASCADE),
+ preserve_default=True,
+ ),
+ migrations.AddField(
+ model_name='answer',
+ name='question',
+ field=models.ForeignKey(to='quiz.Question', on_delete=models.CASCADE),
+ preserve_default=True,
+ ),
+ migrations.AddField(
+ model_name='answer',
+ name='result',
+ field=models.ForeignKey(blank=True, to='quiz.Result', null=True, on_delete=models.CASCADE),
+ preserve_default=True,
+ ),
+ ]