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

    dependencies = [
        ('article', '0002_auto_20190716_1419'),
    ]

    operations = [
        migrations.AlterField(
            model_name='article',
            name='article_image',
            field=models.FileField(blank=True,
                                   null=True,
                                   upload_to='media/',
                                   verbose_name='Article Image'),
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('comment_author',
                 models.CharField(max_length=50, verbose_name='Name')),
                ('comment_content', models.TextField(verbose_name='Comment')),
                ('comment_date', models.DateTimeField(auto_now_add=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='article.Article',
                                   verbose_name=article.models.Article)),
            ],
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0002_comment'),
    ]

    operations = [
        migrations.AddField(
            model_name='article',
            name='thumbnail',
            field=models.FileField(default=b'', upload_to=article.models.get_upload_file_name),
        ),
    ]
Example #3
0
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0002_auto_20200107_0024'),
    ]

    operations = [
        migrations.AlterField(
            model_name='article',
            name='content',
            field=models.FileField(upload_to='articlefiles/%Y/%m/%d/',
                                   verbose_name='文章内容文件'),
        ),
    ]
Example #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0004_auto_20200802_0917'),
    ]

    operations = [
        migrations.AddField(
            model_name='article',
            name='popularity',
            field=models.IntegerField(default=0),
        ),
        migrations.AlterField(
            model_name='mediacontent',
            name='file',
            field=models.FileField(upload_to=article.models.upload_to),
        ),
    ]
Example #5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    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=200)),
                ('body', models.TextField()),
                ('pub_date',
                 models.DateTimeField(verbose_name='date published')),
                ('likes', models.IntegerField(default=0)),
                ('thumbnail',
                 models.FileField(
                     upload_to=article.models.get_upload_file_name)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('first_name', models.CharField(max_length=200)),
                ('second_name', models.CharField(max_length=200)),
                ('body', models.TextField()),
                ('pub_date',
                 models.DateTimeField(verbose_name='date published')),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='article.Article')),
            ],
        ),
    ]
Example #6
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')),
                ('headline', models.CharField(max_length=250)),
                ('content', models.TextField()),
                ('publication_date',
                 models.DateField(default=django.utils.timezone.now)),
                ('creation_time', models.DateTimeField(auto_now_add=True)),
                ('update_time', models.DateTimeField(auto_now=True)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering':
                ('publication_date', 'creation_time', 'update_time'),
            },
        ),
        migrations.CreateModel(
            name='Media',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content',
                 models.FileField(upload_to=article.models.
                                  article_media_content_upload_path)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='article.Article')),
            ],
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('message', models.CharField(max_length=250)),
                ('post_time', models.DateTimeField(auto_now_add=True)),
                ('update_time', models.DateTimeField(auto_now=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='article.Article')),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Example #7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    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=100, verbose_name='标题')),
                ('is_public', models.BooleanField(default=True, verbose_name='公开')),
                ('thumbnail', models.FileField(blank=True, null=True, upload_to=article.models.article_img_path, verbose_name='展示图')),
                ('tags', models.CharField(blank=True, help_text='用空格分隔', max_length=200, null=True, verbose_name='标签')),
                ('summary', models.TextField(verbose_name='摘要')),
                ('content', models.TextField(verbose_name='正文')),
                ('view_times', models.IntegerField(default=0, verbose_name='查看次数')),
                ('zan_times', models.IntegerField(default=0, verbose_name='点赞次数')),
                ('is_top', models.BooleanField(default=False, verbose_name='置顶')),
                ('status', models.IntegerField(choices=[(0, '正常'), (1, '草稿')], default=0, verbose_name='状态')),
                ('is_abandon', models.BooleanField(default=False, verbose_name='是否删除')),
                ('publish_time', models.DateTimeField(default=django.utils.timezone.now, verbose_name='发布时间')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
            ],
            options={
                'verbose_name': '博客',
                'verbose_name_plural': '博客',
                'ordering': ['-is_top', '-view_times', '-publish_time'],
                'permissions': (('view_article', '查看所有文章'),),
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40, verbose_name='名称')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
            ],
            options={
                'verbose_name': '分类',
                'verbose_name_plural': '分类',
                'ordering': ['-create_time'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(verbose_name='评论内容')),
                ('create_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comment_article', to='article.Article', verbose_name='文章')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='article.Comment', verbose_name='引用')),
            ],
            options={
                'verbose_name': '评论',
                'verbose_name_plural': '评论',
            },
        ),
    ]