# -*- coding: utf-8 -*-
# Generated by Django 1.9.10 on 2016-10-14 13:00
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 = [
        ('auth', '0007_alter_validators_add_error_messages'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Forum',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('edited', models.DateTimeField(auto_now=True, verbose_name='Edited')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('title', models.CharField(max_length=120, verbose_name='Title')),
                ('num_topics', models.IntegerField(default=0, verbose_name='Topics in forum')),
                ('num_posts', models.IntegerField(default=0, verbose_name='Posts in forum')),
                ('last_post_date', models.DateTimeField(blank=True, editable=False, null=True)),
                ('last_post_username', models.CharField(blank=True, editable=False, max_length=120)),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('is_public', models.BooleanField(default=True, help_text='Anonymous users will be able to see this forum', verbose_name='Opened to anonymous users')),
                ('is_moderated', models.BooleanField(default=True, verbose_name='Is moderated')),
                ('is_restricted_to_groups', models.BooleanField(default=False, help_text='You must check this in order to restrict the forum to groups', verbose_name='Restricted to groups')),
                ('authorized_groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Groups that can access the forum')),
                ('editor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Edited by')),
            ],
            options={
                'verbose_name': 'Forum',
                'verbose_name_plural': 'Forums',
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('edited', models.DateTimeField(auto_now=True, verbose_name='Edited')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('content', models.TextField(blank=True, null=True, verbose_name='Content')),
                ('responded_to_pk', models.PositiveIntegerField(blank=True, default=0)),
                ('responded_to_username', models.CharField(blank=True, default=b'', max_length=120)),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('editor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Edited by')),
                ('posted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Posted by')),
            ],
            options={
                'verbose_name': 'Post',
                'verbose_name_plural': 'Post',
            },
        ),
        migrations.CreateModel(
            name='Topic',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('edited', models.DateTimeField(auto_now=True, verbose_name='Edited')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('title', models.CharField(max_length=120, verbose_name='Title')),
                ('num_posts', models.IntegerField(default=0, verbose_name='Number of posts')),
                ('num_views', models.IntegerField(default=0, verbose_name='Number of views')),
                ('last_post_date', models.DateTimeField(blank=True, editable=False, null=True)),
                ('last_post_username', models.CharField(blank=True, editable=False, max_length=120)),
                ('is_active', models.BooleanField(default=True, verbose_name='Is Active')),
                ('is_closed', models.BooleanField(default=False, verbose_name='Topic closed')),
                ('is_moderated', models.BooleanField(default=True, verbose_name='Topic is moderated')),
                ('editor', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Edited by')),
                ('forum', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='topics', to='mgof.Forum', verbose_name='Forum')),
                ('posted_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL, verbose_name='Posted by')),
            ],
            options={
                'verbose_name': 'Topic',
                'verbose_name_plural': 'Topics',
            },
        ),
        migrations.AddField(
            model_name='post',
            name='topic',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='posts', to='mgof.Topic', verbose_name='Topic'),
        ),
    ]
