Exemplo n.º 1
0
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0031_auto_20161124_1654'),
    ]

    operations = [
        migrations.AddField(
            model_name='article',
            name='image_height',
            field=models.PositiveIntegerField(editable=False, null=True),
        ),
        migrations.AddField(
            model_name='article',
            name='image_width',
            field=models.PositiveIntegerField(editable=False, null=True),
        ),
        migrations.AlterField(
            model_name='article',
            name='image',
            field=models.ImageField(
                blank=True,
                height_field=b'image_height',
                upload_to=apps.article.models.article_image_upload,
                width_field=b'image_width'),
        ),
    ]
Exemplo n.º 2
0
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0008_auto_20160629_1532'),
    ]

    operations = [
        migrations.AlterField(
            model_name='article',
            name='author',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='articles',
                to=settings.AUTH_USER_MODEL,
                verbose_name='Autor'),
        ),
        migrations.AlterField(
            model_name='article',
            name='image',
            field=models.ImageField(
                blank=True,
                default=b'',
                upload_to=apps.article.models.article_image_upload),
        ),
        migrations.AlterField(
            model_name='article',
            name='status',
            field=models.IntegerField(
                choices=[(3, 'Rascunho'), (2, 'Lixo'), (4, 'Publicado')]),
        ),
    ]
Exemplo n.º 3
0
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0012_article_pin'),
    ]

    operations = [
        migrations.AlterField(
            model_name='article',
            name='image',
            field=models.ImageField(
                blank=True, upload_to=apps.article.models.image_destination),
        ),
    ]
Exemplo n.º 4
0
class Migration(migrations.Migration):

    dependencies = [
        ('article', '0019_auto_20160920_1518'),
    ]

    operations = [
        migrations.AlterField(
            model_name='article',
            name='image',
            field=models.ImageField(
                blank=True,
                upload_to=apps.article.models.article_image_upload),
        ),
    ]
Exemplo n.º 5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('category', '0003_auto_20180401_1436'),
    ]

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('uid', models.CharField(max_length=256)),
                ('title', models.CharField(max_length=256)),
                ('description', models.TextField(blank=True)),
                ('image',
                 models.ImageField(
                     upload_to=apps.article.models.image_destination)),
                ('content', models.TextField(blank=True)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='articles',
                                   to='category.Category')),
            ],
            options={
                'db_table':
                'articles',
                'ordering': ['-id'],
                'permissions':
                (('view_article_list', 'Can view article list'),
                 ('view_article_detail', 'Can view article detail')),
            },
        ),
    ]
Exemplo n.º 6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('category', '0001_initial'),
        ('tag', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('uuid', models.CharField(blank=True, max_length=36)),
                ('slug', models.CharField(max_length=256)),
                ('title', models.CharField(max_length=256)),
                ('description', models.TextField(blank=True)),
                ('image',
                 models.ImageField(
                     blank=True,
                     upload_to=apps.article.models.image_destination)),
                ('content', models.TextField(blank=True)),
                ('use_slide', models.BooleanField(default=False)),
                ('pin', models.BooleanField(default=False)),
                ('thumbnail_in_content', models.BooleanField(default=False)),
                ('order', models.IntegerField(default=1)),
                ('created_at',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('article',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='related_articles',
                                   to='article.Article')),
                ('category',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='articles',
                                   to='category.Category')),
                ('tags', models.ManyToManyField(to='tag.Tag')),
            ],
            options={
                'db_table': 'articles',
                'ordering': ['-order'],
            },
        ),
        migrations.CreateModel(
            name='ArticleTranslation',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('lang', models.CharField(max_length=5)),
                ('title', models.CharField(blank=True, max_length=256)),
                ('description', models.TextField(blank=True)),
                ('content', models.TextField(blank=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='article_translations',
                                   to='article.Article')),
            ],
            options={
                'db_table': 'article_translations',
                'ordering': ['-id'],
                'default_permissions': (),
            },
        ),
    ]
Exemplo n.º 7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(blank=True,
                                  max_length=50,
                                  verbose_name='標籤名稱')),
                ('sort',
                 models.PositiveIntegerField(default=0, verbose_name='排序')),
            ],
            options={
                'verbose_name': 'Tag',
                'verbose_name_plural': 'Tags',
                'ordering': ['sort'],
            },
        ),
        migrations.CreateModel(
            name='Article',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=500, verbose_name='標題')),
                ('content', models.TextField(blank=True, verbose_name='內文')),
                ('slug',
                 models.SlugField(blank=True, max_length=500, unique=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='發佈時間')),
                ('changed',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='修改時間')),
                ('category',
                 models.CharField(choices=[('NEWS', '新聞'), ('EVENT', '活動'),
                                           ('UPDATE', '更新'), ('SCI', '科普文章'),
                                           ('TECH', '技術專欄'), ('PUB', '出版品資料'),
                                           ('POS', 'TaiBIF發表文章/海報'),
                                           ('STATIC', '靜態頁面')],
                                  default='NEWS',
                                  max_length=50,
                                  verbose_name='分類')),
                ('is_pinned',
                 models.CharField(choices=[('N', '否'), ('Y', '是')],
                                  default='N',
                                  max_length=2,
                                  verbose_name='置頂')),
                ('cover',
                 models.ImageField(
                     blank=True,
                     upload_to=apps.article.models.article_cover_path)),
                ('cover_license_text',
                 models.CharField(blank=True,
                                  max_length=100,
                                  verbose_name='授權文字')),
                ('memo',
                 models.CharField(blank=True,
                                  max_length=128,
                                  verbose_name='備註(不會顯示)')),
                ('memo_text',
                 models.TextField(blank=True, verbose_name='備註(多字)')),
                ('tags',
                 models.ManyToManyField(blank=True,
                                        related_name='articles',
                                        to='article.Tag',
                                        verbose_name='標籤')),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
                'ordering': ['-created'],
            },
        ),
    ]