# Generated by Django 2.0.7 on 2018-07-26 11:26

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True, verbose_name='category name')),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100, unique=True, verbose_name='title')),
                ('body', models.TextField(verbose_name='body')),
                ('excerpt', models.CharField(blank=True, max_length=200, verbose_name='excerpt')),
                ('created_time', models.DateField(default=django.utils.timezone.now, verbose_name='created time')),
                ('modified_time', models.DateField(default=django.utils.timezone.now, verbose_name='last modified time')),
                ('views', models.PositiveIntegerField(default=0, verbose_name='page views')),
                ('access_level', models.CharField(choices=[('public', 'public post'), ('private', 'private post'), ('protected', 'require password')], default='public', max_length=10, verbose_name='access level')),
                ('password', models.CharField(blank=True, max_length=128, verbose_name='password')),
                ('sticky', models.BooleanField(default=False, verbose_name='sticky')),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='author')),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category', verbose_name='category')),
            ],
            options={
                'verbose_name_plural': 'posts',
                'verbose_name': 'post',
                'ordering': ['-sticky', '-created_time'],
                'get_latest_by': 'created_time',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, unique=True, verbose_name='tag name')),
            ],
        ),
        migrations.AddField(
            model_name='post',
            name='tags',
            field=models.ManyToManyField(blank=True, to='blog.Tag', verbose_name='tag'),
        ),
    ]
