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

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

    operations = [
        migrations.CreateModel(
            name='PostImage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('images',
                 models.FileField(
                     blank=True,
                     upload_to=apps.article.models.article_cover_path)),
                ('cover_license_text',
                 models.CharField(blank=True,
                                  max_length=100,
                                  verbose_name='授權文字')),
                ('post',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='article.Article')),
            ],
        ),
    ]
Ejemplo n.º 2
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')),
            },
        ),
    ]
Ejemplo n.º 3
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': (),
            },
        ),
    ]
Ejemplo n.º 4
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'],
            },
        ),
    ]