Exemplo n.º 1
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=255, verbose_name='文章标题')),
                ('abstract', models.CharField(blank=True, default='这篇文章没有摘要', max_length=120, verbose_name='文章摘要')),
                ('front_image', models.ImageField(blank=True, max_length=255, null=True, upload_to='articles/%Y/%m/', verbose_name='文章封面')),
                ('content', DjangoUeditor.models.UEditorField(blank=True, default='', verbose_name='文章内容')),
                ('word_count', models.IntegerField(default=0, verbose_name='文章字数')),
                ('click_number', models.IntegerField(default=0, verbose_name='点击量')),
                ('favor_number', models.IntegerField(default=0, verbose_name='收藏量')),
                ('comment_number', models.IntegerField(default=0, verbose_name='评论量')),
                ('add_time', models.DateTimeField(default=datetime.datetime.now, verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
            },
        ),
        migrations.CreateModel(
            name='ArticleCategory',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=25, verbose_name='类别名称')),
                ('add_time', models.DateTimeField(default=datetime.datetime.now, verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '文章类别',
                'verbose_name_plural': '文章类别',
            },
        ),
        migrations.CreateModel(
            name='ArticleTag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=25, verbose_name='标签名称')),
                ('add_time', models.DateTimeField(default=datetime.datetime.now, verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '文章标签',
                'verbose_name_plural': '文章标签',
            },
        ),
        migrations.AddField(
            model_name='article',
            name='category',
            field=models.ForeignKey(on_delete=models.SET(articles.models.get_sentinel_category), to='articles.ArticleCategory', verbose_name='文章类别'),
        ),
        migrations.AddField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(blank=True, to='articles.ArticleTag', verbose_name='文章标签'),
        ),
    ]
Exemplo n.º 2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taxonomies', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Album',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=255,
                                          verbose_name='文集名称')),
                ('brief',
                 models.CharField(blank=True,
                                  default='这个文集暂无简介',
                                  max_length=120,
                                  verbose_name='文集简介')),
                ('cover',
                 models.ImageField(blank=True,
                                   default='albums/images/albumcover.png',
                                   max_length=255,
                                   null=True,
                                   upload_to='albums/images/',
                                   verbose_name='文集封面')),
                ('click_num', models.IntegerField(default=0,
                                                  verbose_name='点击量')),
                ('focus_num', models.IntegerField(default=0,
                                                  verbose_name='关注量')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '文集',
                'verbose_name_plural': '文集',
            },
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=255,
                                           verbose_name='文章标题')),
                ('brief',
                 models.CharField(blank=True,
                                  default='这篇文章没有摘要',
                                  max_length=120,
                                  verbose_name='文章摘要')),
                ('cover',
                 models.ImageField(blank=True,
                                   max_length=255,
                                   null=True,
                                   upload_to='articles/images/',
                                   verbose_name='文章封面')),
                ('content',
                 DjangoUeditor.models.UEditorField(blank=True,
                                                   default='',
                                                   verbose_name='文章内容')),
                ('click_num', models.IntegerField(default=0,
                                                  verbose_name='点击量')),
                ('favor_num', models.IntegerField(default=0,
                                                  verbose_name='收藏量')),
                ('comment_num',
                 models.IntegerField(default=0, verbose_name='评论量')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('album',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='blogs.Album',
                                   verbose_name='所属文集')),
                ('category1',
                 models.ForeignKey(on_delete=models.SET(
                     taxonomies.models.get_sentinel_category1),
                                   to='taxonomies.FirstCategory',
                                   verbose_name='一级类别')),
                ('category2',
                 models.ForeignKey(on_delete=models.SET(
                     taxonomies.models.get_sentinel_category2),
                                   to='taxonomies.SecondCategory',
                                   verbose_name='二级类别')),
                ('tags',
                 models.ManyToManyField(blank=True,
                                        to='taxonomies.Tag',
                                        verbose_name='文章标签')),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
            },
        ),
    ]
Exemplo n.º 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taxonomies', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Algorithm',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('serial_number',
                 models.CharField(default='',
                                  max_length=50,
                                  verbose_name='算法编号')),
                ('name', models.CharField(max_length=100,
                                          verbose_name='算法名称')),
                ('click_number',
                 models.IntegerField(default=0, verbose_name='点击数')),
                ('favor_number',
                 models.IntegerField(default=0, verbose_name='收藏数')),
                ('brief', models.TextField(max_length=500,
                                           verbose_name='算法简介')),
                ('detail',
                 DjangoUeditor.models.UEditorField(default='',
                                                   verbose_name='算法详情')),
                ('front_image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='algorithms/images/',
                                   verbose_name='算法封面图')),
                ('is_hot',
                 models.BooleanField(default=False, verbose_name='是否热门')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('category',
                 models.ForeignKey(on_delete=models.SET(
                     taxonomies.models.get_sentinel_category),
                                   to='taxonomies.Category',
                                   verbose_name='算法类目')),
            ],
            options={
                'verbose_name': '算法',
                'verbose_name_plural': '算法',
            },
        ),
        migrations.CreateModel(
            name='AlgorithmBanner',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(upload_to='banners/', verbose_name='轮播图片')),
                ('index', models.IntegerField(default=0, verbose_name='轮播顺序')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('algorithm',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='algorithms.Algorithm',
                                   verbose_name='算法')),
            ],
            options={
                'verbose_name': '轮播算法',
                'verbose_name_plural': '轮播算法',
            },
        ),
    ]
Exemplo n.º 4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Algorithm',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('serial_number',
                 models.CharField(default='',
                                  max_length=50,
                                  verbose_name='算法编号')),
                ('name', models.CharField(max_length=100,
                                          verbose_name='算法名称')),
                ('click_number',
                 models.IntegerField(default=0, verbose_name='点击数')),
                ('favor_number',
                 models.IntegerField(default=0, verbose_name='收藏数')),
                ('brief', models.TextField(max_length=500,
                                           verbose_name='算法简介')),
                ('description',
                 DjangoUeditor.models.UEditorField(default='',
                                                   verbose_name='算法详情')),
                ('front_image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='algorithm/images/',
                                   verbose_name='算法封面图')),
                ('is_hot',
                 models.BooleanField(default=False, verbose_name='是否热门')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '算法',
                'verbose_name_plural': '算法',
            },
        ),
        migrations.CreateModel(
            name='AlgorithmCategory',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  help_text='类别名',
                                  max_length=30,
                                  verbose_name='类别名')),
                ('description',
                 models.TextField(default='',
                                  help_text='类别描述',
                                  verbose_name='类别描述')),
                ('category_type',
                 models.IntegerField(choices=[(1, '一级类目'), (2, '二级类目'),
                                              (3, '三级类目')],
                                     help_text='类目级别',
                                     verbose_name='类目级别')),
                ('is_tab',
                 models.BooleanField(default=False,
                                     help_text='是否导航',
                                     verbose_name='是否导航')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('parent_category',
                 models.ForeignKey(blank=True,
                                   help_text='父目录',
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='sub_cat',
                                   to='algorithms.AlgorithmCategory',
                                   verbose_name='父类目级别')),
            ],
            options={
                'verbose_name': '算法类别',
                'verbose_name_plural': '算法类别',
            },
        ),
        migrations.CreateModel(
            name='AlgorithmCategoryBrand',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  help_text='品牌名',
                                  max_length=30,
                                  verbose_name='品牌名')),
                ('description',
                 models.TextField(default='',
                                  help_text='品牌描述',
                                  max_length=200,
                                  verbose_name='品牌描述')),
                ('image', models.ImageField(max_length=200,
                                            upload_to='brands/')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('category',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='brands',
                                   to='algorithms.AlgorithmCategory',
                                   verbose_name='算法类目')),
            ],
            options={
                'verbose_name': '品牌',
                'verbose_name_plural': '品牌',
            },
        ),
        migrations.CreateModel(
            name='AlgorithmImage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='',
                                   verbose_name='图片')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('algorithm',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='images',
                                   to='algorithms.Algorithm',
                                   verbose_name='算法')),
            ],
            options={
                'verbose_name': '算法图片',
                'verbose_name_plural': '算法图片',
            },
        ),
        migrations.CreateModel(
            name='Banner',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(upload_to='banner', verbose_name='轮播图片')),
                ('index', models.IntegerField(default=0, verbose_name='轮播顺序')),
                ('add_time',
                 models.DateTimeField(default=datetime.datetime.now,
                                      verbose_name='添加时间')),
                ('algorithm',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='algorithms.Algorithm',
                                   verbose_name='算法')),
            ],
            options={
                'verbose_name': '轮播算法',
                'verbose_name_plural': '轮播算法',
            },
        ),
        migrations.AddField(
            model_name='algorithm',
            name='category',
            field=models.ForeignKey(on_delete=models.SET(
                algorithms.models.get_sentinel_category),
                                    to='algorithms.AlgorithmCategory',
                                    verbose_name='算法类目'),
        ),
    ]