# -*- coding: utf-8 -*-
# Generated by Django 1.9.1 on 2016-01-27 17:00
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import pinax.wiki.models


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='MediaFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', models.DateTimeField(default=django.utils.timezone.now, editable=False)),
                ('filename', models.CharField(max_length=255)),
                ('file', models.FileField(upload_to=pinax.wiki.models.uuid_filename)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='media_files', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Page',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField()),
            ],
        ),
        migrations.CreateModel(
            name='Revision',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField(help_text='Use markdown to mark up your text')),
                ('content_html', models.TextField()),
                ('message', models.TextField(blank=True, help_text='Leave a helpful message about your change')),
                ('created_ip', models.GenericIPAddressField()),
                ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions_created', to=settings.AUTH_USER_MODEL)),
                ('media', models.ManyToManyField(blank=True, related_name='revisions', to='pinax_wiki.MediaFile')),
                ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='pinax_wiki.Page')),
            ],
            options={
                'get_latest_by': 'created_at',
            },
        ),
        migrations.CreateModel(
            name='Wiki',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.IntegerField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
        ),
        migrations.AddField(
            model_name='page',
            name='wiki',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='pages', to='pinax_wiki.Wiki'),
        ),
        migrations.AlterUniqueTogether(
            name='wiki',
            unique_together=set([('content_type', 'object_id')]),
        ),
        migrations.AlterUniqueTogether(
            name='page',
            unique_together=set([('wiki', 'slug')]),
        ),
    ]
