# Generated by Django 2.0.7 on 2018-08-07 20:48

import datetime
from django.conf import settings
import django.contrib.auth.models
import django.contrib.auth.validators
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0009_alter_user_last_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
                ('first_name', models.CharField(blank=True, max_length=30, verbose_name='first name')),
                ('last_name', models.CharField(blank=True, max_length=150, verbose_name='last name')),
                ('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
                ('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
                ('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
                ('email', models.EmailField(blank=True, help_text='电子邮箱', max_length=254, null=True, verbose_name='电子邮箱')),
                ('avatar', models.ImageField(blank=True, default='avatar/default.png', help_text='头像', null=True, upload_to='avatar/', verbose_name='头像')),
                ('age', models.IntegerField(blank=True, help_text='年龄', null=True, verbose_name='年龄')),
                ('website', models.URLField(blank=True, help_text='个人网站', null=True, verbose_name='个人网站')),
                ('hometown', models.CharField(blank=True, help_text='家乡', max_length=64, null=True, verbose_name='家乡')),
                ('introduction', models.CharField(blank=True, help_text='个人简介', max_length=128, null=True, verbose_name='个人简介')),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
                ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
            ],
            options={
                'verbose_name': '用户',
                'verbose_name_plural': '用户',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(help_text='标题', max_length=128, verbose_name='标题')),
                ('post_time', models.DateTimeField(default=datetime.datetime.now, help_text='发布时间', verbose_name='发布时间')),
                ('content', models.TextField(help_text='内容', max_length=20480, verbose_name='内容')),
                ('summary', models.TextField(help_text='摘要', max_length=514, verbose_name='摘要')),
                ('picture', models.ImageField(blank=True, help_text='主图', null=True, upload_to='article_images', verbose_name='主图')),
                ('likes', models.IntegerField(default=0, help_text='点赞数', verbose_name='点赞数')),
                ('views', models.IntegerField(default=0, help_text='阅读数', verbose_name='阅读数')),
                ('author', models.ForeignKey(help_text='作者', on_delete=django.db.models.deletion.CASCADE, related_name='articles', to=settings.AUTH_USER_MODEL, verbose_name='作者')),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField(help_text='评论内容', max_length=256, verbose_name='评论内容')),
                ('post_time', models.DateTimeField(default=datetime.datetime.now, help_text='评论时间', verbose_name='评论时间')),
                ('article', models.ForeignKey(help_text='从属文章', on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='article.Article', verbose_name='从属文章')),
                ('author', models.ForeignKey(help_text='评论人', on_delete=django.db.models.deletion.CASCADE, related_name='comments', to=settings.AUTH_USER_MODEL, verbose_name='评论人')),
            ],
            options={
                'verbose_name': '一级评论',
                'verbose_name_plural': '一级评论',
            },
        ),
        migrations.CreateModel(
            name='Subcomment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('content', models.TextField(help_text='评论内容', max_length=256, verbose_name='评论内容')),
                ('post_time', models.DateTimeField(default=datetime.datetime.now, help_text='评论时间', verbose_name='评论时间')),
                ('article', models.ForeignKey(help_text='从属文章', on_delete=django.db.models.deletion.CASCADE, to='article.Article', verbose_name='从属文章')),
                ('author', models.ForeignKey(help_text='评论人', on_delete=django.db.models.deletion.CASCADE, related_name='sub_comments', to=settings.AUTH_USER_MODEL, verbose_name='评论人')),
                ('parent_comment', models.ForeignKey(help_text='父评论', on_delete=django.db.models.deletion.CASCADE, related_name='sub_comments', to='article.Comment', verbose_name='父评论')),
                ('reply_to', models.ForeignKey(help_text='回复给', on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='回复给')),
            ],
            options={
                'verbose_name': '二级评论',
                'verbose_name_plural': '二级评论',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='标签名', max_length=32, unique=True, verbose_name='标签名')),
                ('chinese_name', models.CharField(blank=True, help_text='标签中文名', max_length=32, null=True, verbose_name='标签中文名')),
                ('slug', models.SlugField(blank=True, help_text='标签slug', unique=True, verbose_name='标签slug')),
                ('desc', models.CharField(blank=True, help_text='标签描述', max_length=128, null=True, verbose_name='标签描述')),
            ],
            options={
                'verbose_name': '标签',
                'verbose_name_plural': '标签',
            },
        ),
        migrations.AddField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(blank=True, help_text='标签', related_name='articles', to='article.Tag', verbose_name='标签'),
        ),
    ]
