# Generated by Django 2.0.2 on 2020-03-04 14:44

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


class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Ad',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(help_text='标题', max_length=50, verbose_name='标题')),
                ('pic', models.ImageField(help_text='广告图', upload_to='uploads', verbose_name='广告图')),
                ('adurl', models.URLField(help_text='地址', verbose_name='地址')),
                ('adlocation', models.CharField(help_text='位置', max_length=2, verbose_name='位置')),
                ('status', models.CharField(default=1, help_text='状态', max_length=1, verbose_name='状态')),
            ],
        ),
        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=100, verbose_name='标题')),
                ('slug', models.SlugField(unique_for_year='publish_date', verbose_name='描述')),
                ('content', DjangoUeditor.models.UEditorField(blank=True, default='', verbose_name='内容')),
                ('status', models.CharField(help_text='状态', max_length=2, verbose_name='状态')),
                ('publish_date', models.DateTimeField(default=datetime.datetime(2020, 3, 4, 14, 44, 27, 134991), help_text='发布日期', verbose_name='发布日期')),
                ('expiration_date', models.DateTimeField(blank=True, help_text='有效日期', null=True, verbose_name='有效日期')),
                ('is_active', models.BooleanField(default=True, help_text='是否热门', verbose_name='是否热门')),
                ('pic', models.ImageField(help_text='图片', upload_to='uploads', verbose_name='图片')),
                ('praise_num', models.IntegerField(default=0, help_text='点赞', verbose_name='点赞')),
                ('read_num', models.IntegerField(default=0, help_text='浏览数', verbose_name='浏览数')),
                ('fav_num', models.IntegerField(default=0, help_text='收藏数', verbose_name='收藏数')),
                ('author', models.ForeignKey(help_text='作者', on_delete=django.db.models.deletion.CASCADE, related_name='author', to=settings.AUTH_USER_MODEL, verbose_name='作者')),
            ],
            options={
                'verbose_name': '新闻文章',
                'verbose_name_plural': '新闻文章',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(help_text='大类', max_length=20, verbose_name='名称')),
            ],
            options={
                'ordering': ['title'],
                'verbose_name': '新闻类别',
                'verbose_name_plural': '新闻类别',
            },
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(help_text='名称', max_length=20, verbose_name='名称')),
                ('created_date', models.DateTimeField(default=datetime.datetime.now, help_text='创建时间', verbose_name='创建时间')),
                ('completed', models.BooleanField(default=False, help_text='是否完成', verbose_name='是否完成')),
                ('categorys', models.ForeignKey(help_text='大类', on_delete=django.db.models.deletion.CASCADE, related_name='items', to='article.Category')),
            ],
            options={
                'ordering': ['title'],
                '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=50, verbose_name='名称')),
                ('slug', models.SlugField(verbose_name='描述')),
            ],
            options={
                'ordering': ['id'],
                'verbose_name': '标签',
                'verbose_name_plural': '标签',
            },
        ),
        migrations.CreateModel(
            name='UserFav',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('add_time', models.DateTimeField(default=datetime.datetime.now, verbose_name='添加时间')),
                ('articles', models.ForeignKey(help_text='文章id', on_delete=django.db.models.deletion.CASCADE, related_name='articles', to='article.Article', verbose_name='文章')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL, verbose_name='用户')),
            ],
            options={
                'verbose_name': '用户收藏',
                'verbose_name_plural': '用户收藏',
            },
        ),
        migrations.AddField(
            model_name='article',
            name='item',
            field=models.ForeignKey(help_text='类别名称', on_delete=django.db.models.deletion.CASCADE, related_name='item', to='article.Item', verbose_name='类别名称'),
        ),
        migrations.AddField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(blank=True, help_text='标签', related_name='tags', to='article.Tag'),
        ),
        migrations.AlterUniqueTogether(
            name='userfav',
            unique_together={('user', 'articles')},
        ),
    ]
