Exemple #1
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=150,
                                           verbose_name='文章标题')),
                ('slug', models.SlugField(max_length=250, unique=True)),
                ('summary',
                 models.TextField(default='文章摘要等同于网页description内容,请务必填写...',
                                  max_length=230,
                                  verbose_name='文章摘要')),
                ('body', mdeditor.fields.MDTextField(verbose_name='文章内容')),
                ('image',
                 models.ImageField(
                     upload_to=article.models.articleimage_directory_path,
                     verbose_name='图片')),
                ('create_date',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_date',
                 models.DateTimeField(auto_now=True, verbose_name='修改时间')),
                ('views', models.IntegerField(default=0, verbose_name='阅览量')),
                ('likes', models.PositiveIntegerField(default=0)),
                ('is_top', models.BooleanField(default=False,
                                               verbose_name='置顶')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='作者')),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
                'ordering': ['-create_date'],
            },
        ),
        migrations.CreateModel(
            name='Carousel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('number',
                 models.IntegerField(help_text='编号决定图片播放的顺序,图片不要多于5张',
                                     verbose_name='编号')),
                ('title',
                 models.CharField(blank=True,
                                  help_text='标题可以为空',
                                  max_length=20,
                                  null=True,
                                  verbose_name='标题')),
                ('content', models.CharField(max_length=80,
                                             verbose_name='描述')),
                ('image',
                 models.ImageField(upload_to='banner/%Y%m',
                                   verbose_name='轮播图')),
                ('url',
                 models.CharField(default='#',
                                  help_text='图片跳转的超链接,默认#表示不跳转',
                                  max_length=256,
                                  verbose_name='跳转链接')),
            ],
            options={
                'verbose_name': '图片轮播',
                'verbose_name_plural': '图片轮播',
                'ordering': ['number', '-id'],
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=20, verbose_name='文章分类')),
                ('slug', models.SlugField(unique=True)),
                ('description',
                 models.TextField(help_text='用来作为SEO中description,长度参考SEO标准',
                                  max_length=240,
                                  verbose_name='描述')),
            ],
            options={
                'verbose_name': '分类',
                'verbose_name_plural': '分类',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Course',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=20, verbose_name='教程')),
                ('slug', models.SlugField(unique=True)),
                ('description',
                 models.TextField(help_text='用来作为SEO中description,长度参考SEO标准',
                                  max_length=240,
                                  verbose_name='描述')),
            ],
            options={
                'verbose_name': '教程',
                'verbose_name_plural': '教程',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Keyword',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=20,
                                          verbose_name='文章关键词')),
            ],
            options={
                'verbose_name': '关键词',
                'verbose_name_plural': '关键词',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=20, verbose_name='文章标签')),
                ('slug', models.SlugField(unique=True)),
                ('description',
                 models.TextField(help_text='用来作为SEO中description,长度参考SEO标准',
                                  max_length=240,
                                  verbose_name='描述')),
            ],
            options={
                'verbose_name': '标签',
                'verbose_name_plural': '标签',
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('body', ckeditor.fields.RichTextField()),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='article.Article',
                                   verbose_name='文章评论')),
            ],
            options={
                'ordering': ('created', ),
            },
        ),
        migrations.AddField(
            model_name='article',
            name='category',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                to='article.Category',
                verbose_name='文章分类'),
        ),
        migrations.AddField(
            model_name='article',
            name='course',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.PROTECT,
                to='article.Course',
                verbose_name='课程'),
        ),
        migrations.AddField(
            model_name='article',
            name='keywords',
            field=models.ManyToManyField(
                help_text='文章关键词,用来作为SEO中keywords,最好使用长尾词,3-4个足够',
                to='article.Keyword',
                verbose_name='文章关键词'),
        ),
        migrations.AddField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(to='article.Tag', verbose_name='标签'),
        ),
    ]
Exemple #2
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('uuid',
                 models.UUIDField(default=uuid.uuid4,
                                  editable=False,
                                  primary_key=True,
                                  serialize=False)),
                ('title', models.CharField(max_length=2048)),
                ('html', models.TextField()),
                ('cover_image',
                 models.ImageField(height_field='cover_image_height',
                                   upload_to='article/static/media/',
                                   width_field='cover_image_width')),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('cover_image_height', models.IntegerField()),
                ('cover_image_width', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   primary_key=True,
                                   serialize=False,
                                   to=settings.AUTH_USER_MODEL)),
                ('is_email_validated', models.BooleanField(default=False)),
                ('picture',
                 models.ImageField(default=article.models.default_image,
                                   height_field='picture_height',
                                   upload_to='article/static/media',
                                   width_field='picture_width')),
                ('picture_height', models.IntegerField()),
                ('picture_width', models.IntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='ReadingList',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=256)),
                ('description', models.CharField(max_length=2048)),
                ('articles',
                 models.ManyToManyField(blank=True, to='article.Article')),
            ],
        ),
        migrations.AddField(
            model_name='article',
            name='author',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='article.Author'),
        ),
        migrations.AddField(
            model_name='article',
            name='reading_lists',
            field=models.ManyToManyField(blank=True, to='article.ReadingList'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('article', '0017_articlepost_word_count'),
    ]

    operations = [
        migrations.CreateModel(
            name='LightBlogArticle',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=50,
                                           verbose_name=' 文章标题 ')),
                ('article_status', models.IntegerField(default=1)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name=' 创建时间 ')),
                ('updated',
                 models.DateTimeField(auto_now=True, verbose_name=' 更新时间 ')),
                ('article_body', models.TextField(verbose_name=' 文章内容 ')),
                ('article_wordCount',
                 models.IntegerField(default=233, verbose_name=' 文章字数 ')),
                ('article_preview',
                 imagekit.models.fields.ProcessedImageField(
                     default='default/preview.jpg',
                     upload_to=article.models.lightblog_articlepreview,
                     verbose_name='展示图片')),
                ('article_descripton',
                 models.CharField(max_length=30, verbose_name=' 文章简介 ')),
                ('isRecommend',
                 models.BooleanField(default=False, verbose_name=' 是否推荐 ')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='lightblog_article',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='LightBlogSpecialColumn',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('special_column',
                 models.CharField(max_length=50, verbose_name=' 专栏名称 ')),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name=' 创建时间 ')),
                ('description',
                 models.CharField(max_length=100, verbose_name=' 专栏简介 ')),
                ('image_preview',
                 imagekit.models.fields.ProcessedImageField(
                     default='default/preview.jpg',
                     upload_to=article.models.lightblog_specialcolumn,
                     verbose_name='展示图片')),
                ('create_user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='lightblog_specialcolumn',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='LightBlogPersonalColumn',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('personal_column',
                 models.CharField(max_length=20, verbose_name=' 个人栏目 ')),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name=' 创建时间 ')),
                ('description',
                 models.CharField(max_length=100, verbose_name=' 栏目简介 ')),
                ('image_preview',
                 imagekit.models.fields.ProcessedImageField(
                     default='default/preview.jpg',
                     upload_to=article.models.lightblog_personalcolumn,
                     verbose_name='展示图片')),
                ('create_user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='lightblog_personalcolumn',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='LightBlogArticleImage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image_preview',
                 imagekit.models.fields.ProcessedImageField(
                     upload_to=article.models.lightblog_articleimgs,
                     verbose_name='上传图片')),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='lightblog_articleimage',
                                   to='article.LightBlogArticle')),
            ],
        ),
        migrations.AddField(
            model_name='lightblogarticle',
            name='personalColumn',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='article_personalcolumn',
                to='article.LightBlogPersonalColumn'),
        ),
        migrations.AddField(
            model_name='lightblogarticle',
            name='specialColumn',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='article_specialcolumn',
                to='article.LightBlogSpecialColumn'),
        ),
        migrations.AddField(
            model_name='lightblogarticle',
            name='users_dislike',
            field=models.ManyToManyField(
                blank=True,
                related_name='lightblog_users_dislike',
                to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='lightblogarticle',
            name='users_like',
            field=models.ManyToManyField(blank=True,
                                         related_name='lightblog_users_like',
                                         to=settings.AUTH_USER_MODEL),
        ),
    ]
Exemple #4
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('article_title',
                 models.CharField(max_length=200,
                                  verbose_name='Название статьи')),
                ('article_date',
                 models.DateTimeField(verbose_name='Дата публикации статьи')),
                ('article_likes',
                 models.IntegerField(default=0, verbose_name='Лайки')),
                ('article_author',
                 models.CharField(blank=True,
                                  max_length=200,
                                  verbose_name='Автор статьи')),
                ('short_text_ru',
                 ckeditor_uploader.fields.RichTextUploadingField(
                     blank=True, verbose_name='Короткое описание RU')),
                ('short_text_en',
                 ckeditor_uploader.fields.RichTextUploadingField(
                     blank=True, verbose_name='Короткое описание EN')),
                ('video',
                 models.CharField(blank=True,
                                  max_length=250,
                                  verbose_name='Видео id в кратком описании')),
                ('image',
                 easy_thumbnails.fields.ThumbnailerImageField(
                     blank=True,
                     upload_to=article.models.make_upload_path,
                     verbose_name='Изображение')),
                ('full_text_ru',
                 ckeditor_uploader.fields.RichTextUploadingField(
                     blank=True, verbose_name='Полное описание RU')),
                ('full_text_en',
                 ckeditor_uploader.fields.RichTextUploadingField(
                     blank=True, verbose_name='Полное описание EN')),
                ('article_video',
                 embed_video.fields.EmbedVideoField(help_text='описание видео',
                                                    verbose_name='Видео')),
            ],
            options={
                'verbose_name': 'Статья',
                'verbose_name_plural': 'Статьи',
                'db_table': 'article',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('category_name',
                 models.CharField(
                     max_length=25,
                     verbose_name='Название категории транслитом')),
                ('category_title',
                 models.CharField(blank=True,
                                  max_length=25,
                                  null=True,
                                  verbose_name='Имя категории')),
            ],
            options={
                'verbose_name': 'Категорию',
                'verbose_name_plural': 'Категории',
                'db_table': 'category',
            },
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('comments_create',
                 models.DateTimeField(auto_now_add=True,
                                      null=True,
                                      verbose_name='Дата')),
                ('comments_text',
                 models.TextField(verbose_name='Добавте Ваш комментарий')),
                ('comments_article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='article.Article',
                                   verbose_name='Статья')),
                ('comments_user',
                 models.ForeignKey(default=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Комментарий',
                'verbose_name_plural': 'Комментарии',
                'db_table': 'comments',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('tag_name',
                 models.CharField(max_length=25,
                                  verbose_name='Название тега транслитом')),
                ('tag_title',
                 models.CharField(max_length=25, verbose_name='Имя тега')),
            ],
            options={
                'verbose_name': 'тега',
                'verbose_name_plural': 'тег',
                'db_table': 'tags',
            },
        ),
        migrations.AddField(
            model_name='article',
            name='article_category',
            field=models.ForeignKey(
                default=0,
                on_delete=django.db.models.deletion.CASCADE,
                related_name='articles',
                to='article.Category',
                verbose_name='Категории'),
        ),
        migrations.AddField(
            model_name='article',
            name='article_tag',
            field=models.ManyToManyField(related_name='articles',
                                         to='article.Tag',
                                         verbose_name='Теги'),
        ),
    ]
Exemple #5
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('bg_img',
                 models.ImageField(
                     blank=True,
                     null=True,
                     upload_to=article.models.scramble_upload_img_name,
                     verbose_name='\u6807\u9898\u80cc\u666f')),
                ('title',
                 models.CharField(max_length=100,
                                  verbose_name='\u6807\u9898')),
                ('body', models.TextField(verbose_name='\u6b63\u6587')),
                ('abstract',
                 models.CharField(
                     blank=True,
                     help_text=
                     '\u6b64\u4e3a\u53ef\u9009\u9879\uff0c\u82e5\u4e3a\u7a7a\u683c\u5219\u6458\u53d6\u6b63\u6587\u524d50\u4e2a\u5b57\u7b26',
                     max_length=54,
                     null=True,
                     verbose_name='\u6458\u8981')),
                ('created_time',
                 models.DateTimeField(
                     auto_now_add=True,
                     verbose_name='\u521b\u5efa\u65f6\u95f4')),
                ('last_modified_time',
                 models.DateField(auto_now=True,
                                  verbose_name='\u4fee\u6539\u65f6\u95f4')),
                ('status',
                 models.CharField(choices=[('Editing', 'Editing'),
                                           ('Published', 'Published')],
                                  max_length=10,
                                  verbose_name='\u6587\u7ae0\u72b6\u6001')),
                ('topped',
                 models.BooleanField(default=False,
                                     verbose_name='\u662f\u5426\u7f6e\u9876')),
                ('views',
                 models.PositiveIntegerField(
                     default=0, verbose_name='\u70b9\u51fb\u91cf')),
            ],
            options={
                'ordering': ['-last_modified_time'],
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=20,
                                  verbose_name='\u7c7b\u76ee\u540d\u79f0')),
                ('created_time',
                 models.DateTimeField(
                     auto_now_add=True,
                     verbose_name='\u521b\u5efa\u65f6\u95f4')),
                ('last_modified_time',
                 models.DateTimeField(
                     auto_now=True, verbose_name='\u4fee\u6539\u65f6\u95f4')),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='categories',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='\u4f5c\u8005')),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=20,
                                  verbose_name='\u6807\u7b7e\u540d\u79f0')),
                ('created_time',
                 models.DateTimeField(
                     auto_now_add=True,
                     verbose_name='\u521b\u5efa\u65f6\u95f4')),
                ('last_modified_time',
                 models.DateTimeField(
                     auto_now=True, verbose_name='\u4fee\u6539\u65f6\u95f4')),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='tags',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='\u4f5c\u8005')),
            ],
        ),
        migrations.AddField(
            model_name='article',
            name='category',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name='articles',
                to='article.Category',
                verbose_name='\u5206\u7c7b'),
        ),
        migrations.AddField(
            model_name='article',
            name='owner',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='articles',
                to=settings.AUTH_USER_MODEL,
                verbose_name='\u4f5c\u8005'),
        ),
        migrations.AddField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(
                blank=True,
                related_name='articles',
                to='article.Tag',
                verbose_name='\u6807\u7b7e\u96c6\u5408'),
        ),
    ]