# -*- coding: utf-8 -*-
# Generated by Django 1.9.5 on 2016-04-12 15:03
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Rating',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(blank=True, choices=[(b'5', b'5'), (b'4', b'4'), (b'3', b'3'), (b'2', b'2'), (b'1', b'1')], max_length=20, null=True, verbose_name='Value')),
            ],
            options={
                'ordering': ['category', 'review'],
            },
        ),
        migrations.CreateModel(
            name='RatingCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('identifier', models.SlugField(blank=True, max_length=32, verbose_name='Identifier')),
                ('counts_for_average', models.BooleanField(default=True, verbose_name='Counts for average rating')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RatingCategoryChoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(blank=True, max_length=20, null=True, verbose_name='Value')),
                ('ratingcategory', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='choices', to='review.RatingCategory', verbose_name='Rating category')),
            ],
            options={
                'ordering': ('-value',),
            },
        ),
        migrations.CreateModel(
            name='RatingCategoryChoiceTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label', models.CharField(max_length=128, verbose_name='Label')),
                ('language_code', models.CharField(db_index=True, max_length=15)),
                ('master', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='review.RatingCategoryChoice')),
            ],
            options={
                'managed': True,
                'abstract': False,
                'db_table': 'review_ratingcategorychoice_translation',
                'db_tablespace': '',
                'default_permissions': (),
            },
        ),
        migrations.CreateModel(
            name='RatingCategoryTranslation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('question', models.CharField(blank=True, max_length=512, null=True)),
                ('language_code', models.CharField(db_index=True, max_length=15)),
                ('master', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='translations', to='review.RatingCategory')),
            ],
            options={
                'managed': True,
                'abstract': False,
                'db_table': 'review_ratingcategory_translation',
                'db_tablespace': '',
                'default_permissions': (),
            },
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.PositiveIntegerField()),
                ('content', models.TextField(blank=True, max_length=1024, verbose_name='Content')),
                ('language', models.CharField(blank=True, max_length=5, verbose_name='Language')),
                ('creation_date', models.DateTimeField(auto_now_add=True, verbose_name='Creation date')),
                ('average_rating', models.FloatField(default=0, verbose_name='Average rating')),
                ('extra_object_id', models.PositiveIntegerField(blank=True, null=True)),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('extra_content_type', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='reviews_attached', to='contenttypes.ContentType')),
                ('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='User')),
            ],
            options={
                'ordering': ['-creation_date'],
            },
        ),
        migrations.CreateModel(
            name='ReviewExtraInfo',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('type', models.CharField(max_length=256, verbose_name='Type')),
                ('object_id', models.PositiveIntegerField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('review', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.Review', verbose_name='Review')),
            ],
            options={
                'ordering': ['type'],
            },
        ),
        migrations.AddField(
            model_name='rating',
            name='category',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='review.RatingCategory', verbose_name='Category'),
        ),
        migrations.AddField(
            model_name='rating',
            name='review',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='ratings', to='review.Review', verbose_name='Review'),
        ),
        migrations.AlterUniqueTogether(
            name='ratingcategorytranslation',
            unique_together=set([('language_code', 'master')]),
        ),
        migrations.AlterUniqueTogether(
            name='ratingcategorychoicetranslation',
            unique_together=set([('language_code', 'master')]),
        ),
    ]
