コード例 #1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Articles',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=150)),
                ('content', models.TextField()),
                ('slug', models.SlugField()),
                ('date_posted', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('image', models.ImageField(blank=True, null=True, upload_to=articles.models.upload_dir_path)),
                ('cropping', image_cropping.fields.ImageRatioField('image', '1000x1000', adapt_rotation=False, allow_fullsize=False, free_crop=False, help_text=None, hide_image_field=False, size_warning=False, verbose_name='cropping')),
                ('article_choices', models.CharField(choices=[('P', 'Python'), ('D', 'Django'), ('DRF', 'Django Rest Framework'), ('JS', 'Javascript'), ('R', 'React'), ('M', 'MySQL'), ('H', 'HTML'), ('C', 'CSS'), ('RA', 'RELATED_ARTICLES')], default='P', max_length=3)),
            ],
            options={
                'verbose_name_plural': 'articles',
            },
        ),
    ]
コード例 #2
0
class Migration(migrations.Migration):

    dependencies = [
        ('taggit', '0003_taggeditem_add_unique_index'),
        ('articles', '0002_auto_20200106_1720'),
    ]

    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=250,
                                           verbose_name='Title')),
                ('writer',
                 models.CharField(max_length=100, verbose_name='Writer')),
                ('genre',
                 models.CharField(choices=[('adventure', 'Adventure'),
                                           ('fiction', 'Fiction'),
                                           ('non_fiction', 'Non Fiction'),
                                           ('technology', 'Technology'),
                                           ('lifestyle', 'Lifestyle')],
                                  max_length=20,
                                  verbose_name='Genre')),
                ('published_on',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='Published on')),
                ('modified_on',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='Modified on')),
                ('title_image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=articles.models.upload_image,
                                   verbose_name='Title Image')),
                ('body', tinymce.models.HTMLField(verbose_name='Content')),
                ('slug',
                 models.SlugField(blank=True, unique=True,
                                  verbose_name='slug')),
                ('keywords',
                 taggit.managers.TaggableManager(
                     blank=True,
                     help_text='A comma-separated list of tags.',
                     through='taggit.TaggedItem',
                     to='taggit.Tag',
                     verbose_name='Keywords')),
            ],
        ),
        migrations.DeleteModel(name='articles', ),
    ]
コード例 #3
0
ファイル: 0002_auto_20180101_2103.py プロジェクト: kenjap/ICL
class Migration(migrations.Migration):

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

    operations = [
        migrations.AlterModelOptions(
            name='article',
            options={'ordering': ['-timestamp', 'update']},
        ),
        migrations.RenameField(
            model_name='article',
            old_name='body',
            new_name='content',
        ),
        migrations.RemoveField(
            model_name='article',
            name='date',
        ),
        migrations.AddField(
            model_name='article',
            name='height_field',
            field=models.IntegerField(default=0),
        ),
        migrations.AddField(
            model_name='article',
            name='image',
            field=models.ImageField(blank=True, height_field='height_field', null=True, upload_to=articles.models.upload_location, width_field='width_field'),
        ),
        migrations.AddField(
            model_name='article',
            name='timestamp',
            field=models.DateTimeField(auto_now_add=True, null=True),
        ),
        migrations.AddField(
            model_name='article',
            name='update',
            field=models.DateTimeField(auto_now=True, null=True),
        ),
        migrations.AddField(
            model_name='article',
            name='width_field',
            field=models.IntegerField(default=0),
        ),
        migrations.AlterField(
            model_name='article',
            name='slug',
            field=models.SlugField(unique=True),
        ),
    ]
コード例 #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')),
                ('title', models.CharField(max_length=255)),
                ('image',
                 models.ImageField(
                     blank=True,
                     null=True,
                     storage=nwaben.storage_backends.PublicMediaStorage(),
                     upload_to=articles.models.upload_dir)),
                ('slug', models.SlugField(max_length=255, unique=True)),
                ('view_count', models.PositiveIntegerField(default=0)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('draft', models.BooleanField(default=True)),
                ('description',
                 ckeditor.fields.RichTextField(blank=True, null=True)),
                ('body',
                 ckeditor_uploader.fields.RichTextUploadingField(blank=True,
                                                                 null=True)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Articles',
                'ordering': ('-created', ),
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100, unique=True)),
            ],
            options={
                'verbose_name_plural': 'Categories',
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField(blank=True, null=True)),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='articles.Article')),
                ('by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['created_on'],
            },
        ),
        migrations.CreateModel(
            name='Reply',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('replied_on', models.DateTimeField(auto_now_add=True)),
                ('comment',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='replies',
                                   to='articles.Comment')),
                ('replied_by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['replied_on'],
            },
        ),
        migrations.AddField(
            model_name='article',
            name='category',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='articles.Category'),
        ),
        migrations.AlterUniqueTogether(
            name='article',
            unique_together={('slug', 'title')},
        ),
    ]
コード例 #5
0
ファイル: 0001_initial.py プロジェクト: kmoua12/SiriusCRUD
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='title')),
                ('description',
                 models.TextField(blank=True,
                                  help_text='Type a description...',
                                  max_length=512,
                                  verbose_name='description')),
                ('slug', models.SlugField(editable=False, unique=True)),
                ('section',
                 models.PositiveSmallIntegerField(blank=True, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('is_public', models.BooleanField(default=True)),
                ('semester',
                 models.CharField(blank=True,
                                  choices=[('', '---------'), ('FA', 'Fall'),
                                           ('WI', 'Winter'), ('SP', 'Spring'),
                                           ('SU', 'Summer')],
                                  default='FA',
                                  max_length=2,
                                  verbose_name='semester')),
                ('year',
                 models.PositiveSmallIntegerField(
                     blank=True,
                     choices=[('', '---------'), (2019, 2019), (2018, 2018),
                              (2017, 2017), (2016, 2016), (2015, 2015),
                              (2014, 2014), (2013, 2013), (2012, 2012),
                              (2011, 2011), (2010, 2010), (2009, 2009),
                              (2008, 2008), (2007, 2007), (2006, 2006),
                              (2005, 2005), (2004, 2004), (2003, 2003),
                              (2002, 2002), (2001, 2001), (2000, 2000)],
                     default=articles.models.Article.current_year,
                     null=True,
                     verbose_name='year')),
            ],
        ),
        migrations.CreateModel(
            name='ArticleMedia',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('article_media',
                 models.FileField(
                     upload_to=articles.models.ArticleMedia.upload_to,
                     verbose_name='file upload')),
                ('article_type',
                 models.CharField(choices=[('', '---------'),
                                           ('AD', 'Analyzed Data'),
                                           ('PO', 'Poster'),
                                           ('RD', 'Raw Data'),
                                           ('RE', 'Report'), ('OT', 'Other')],
                                  help_text='Select the file type',
                                  max_length=2,
                                  verbose_name='article type')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='media',
                                   to='articles.Article')),
            ],
        ),
    ]
コード例 #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')),
                ('title', models.CharField(max_length=200)),
                ('slug', models.SlugField(max_length=200, unique=True)),
                ('image_url',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=articles.models.upload_dir)),
                ('description', models.TextField()),
                ('body', models.TextField()),
                ('view_count', models.PositiveIntegerField(default=0)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('draft', models.BooleanField(default=True)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name_plural': 'Articles',
                'ordering': ('-created', ),
                'unique_together': {('title', 'slug')},
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='articles.article')),
                ('by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['created_on'],
            },
        ),
        migrations.CreateModel(
            name='Reply',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('replied_on', models.DateTimeField(auto_now_add=True)),
                ('comment',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='replies',
                                   to='articles.comment')),
                ('replied_by',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['replied_on'],
            },
        ),
    ]
コード例 #7
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Articles',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(db_index=True,
                                  max_length=300,
                                  verbose_name='Название статьи')),
                ('slug',
                 models.SlugField(max_length=300,
                                  unique=True,
                                  verbose_name='Ссылка')),
                ('body',
                 ckeditor.fields.RichTextField(blank=True,
                                               db_index=True,
                                               verbose_name='Описание')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('desc_for_find',
                 models.TextField(blank=True,
                                  db_index=True,
                                  verbose_name='Описание для поиска')),
                ('keywords',
                 models.CharField(blank=True,
                                  max_length=200,
                                  verbose_name='Кейвордс')),
                ('img_file',
                 models.ImageField(
                     blank=True,
                     null=True,
                     upload_to=articles.models.generate_filename_jpg,
                     verbose_name='IMG')),
                ('attribution',
                 models.CharField(db_index=True,
                                  default=' ',
                                  max_length=300,
                                  verbose_name='Ссылка на источник')),
            ],
            options={
                'verbose_name': 'Статья',
                'verbose_name_plural': 'Статьи',
                'ordering': ['-created'],
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(db_index=True,
                                  max_length=200,
                                  verbose_name='Категория')),
                ('slug',
                 models.SlugField(max_length=200,
                                  unique=True,
                                  verbose_name='Ссылка')),
                ('desc_for_find',
                 models.TextField(blank=True,
                                  db_index=True,
                                  verbose_name='Описание для поиска')),
                ('keywords',
                 models.CharField(blank=True,
                                  max_length=200,
                                  verbose_name='Кейвордс')),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
            },
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('comment_text',
                 models.TextField(verbose_name='Добавить комментарий')),
                ('comment_created', models.DateTimeField(auto_now_add=True)),
                ('comment_article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='articles.Articles')),
                ('comment_author',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Комментарий',
                'verbose_name_plural': 'Комментарии',
            },
        ),
        migrations.AddField(
            model_name='articles',
            name='category',
            field=models.ManyToManyField(blank=True,
                                         related_name='articles',
                                         to='articles.Category',
                                         verbose_name='Категория'),
        ),
    ]
コード例 #8
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('is_active', models.BooleanField(default=True)),
                ('is_featured', models.BooleanField(default=False)),
                ('status', models.CharField(choices=[('draft', 'Draft'), ('public', 'Public')], default='draft', max_length=20)),
                ('publish', models.DateTimeField(default=articles.models.default_start_time)),
                ('title', models.CharField(max_length=280)),
                ('slug', models.SlugField(blank=True, default='', max_length=280, unique=True)),
                ('content', ckeditor.fields.RichTextField()),
                ('description', models.TextField(blank=True, null=True)),
                ('seo_title', models.CharField(blank=True, max_length=70, null=True)),
                ('seo_description', models.CharField(blank=True, max_length=160, null=True)),
                ('post_image', models.ImageField(blank=True, null=True, upload_to='post_images/')),
                ('post_thumb', models.ImageField(blank=True, null=True, upload_to='post_thumbs/')),
                ('post_image_alt', models.CharField(blank=True, max_length=280, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('author', models.ForeignKey(blank=True, null=True, on_delete='SET_DEFAULT', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'Post',
                'verbose_name_plural': 'Posts',
                'db_table': 'post',
                'ordering': ('-publish',),
                'get_latest_by': 'date',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, max_length=100)),
                ('slug', models.SlugField(unique=True)),
                ('description', models.TextField(blank=True, null=True)),
                ('is_active', models.BooleanField(default=True)),
                ('seo_title', models.CharField(blank=True, max_length=60, null=True)),
                ('seo_description', models.CharField(blank=True, max_length=165, null=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Tag',
                'verbose_name_plural': 'Tags',
                'db_table': 'tag',
                'ordering': ('title',),
            },
        ),
        migrations.AddField(
            model_name='post',
            name='tags',
            field=models.ManyToManyField(blank=True, to='articles.Tag'),
        ),
    ]
コード例 #9
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,
                                  verbose_name='Название статьи')),
                ('text', models.TextField(verbose_name='Текст статьи')),
                ('pub_date', models.DateField(verbose_name='Дата добавления')),
            ],
            options={
                'verbose_name': 'Статья',
                'verbose_name_plural': 'Статьи',
            },
        ),
        migrations.CreateModel(
            name='Partner',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('full_name', models.CharField(max_length=300, unique=True)),
                ('short_name', models.CharField(max_length=15, unique=True)),
                ('slug', models.SlugField(unique=True)),
                ('icon',
                 models.ImageField(upload_to=articles.models.image_folder)),
            ],
            options={
                'verbose_name': 'Партнер',
                'verbose_name_plural': 'Партнеры',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(max_length=30,
                                  verbose_name='Название тега')),
            ],
            options={
                'verbose_name': 'Тег',
                'verbose_name_plural': 'Теги',
            },
        ),
        migrations.AddField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(to='articles.Tag',
                                         verbose_name='Теги'),
        ),
    ]
コード例 #10
0
ファイル: 0001_initial.py プロジェクト: Fcmam5/sdh_foundation
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)),
                ('slug', models.SlugField(max_length=100, unique=True)),
                ('body', models.TextField()),
                ('posted',
                 models.DateTimeField(auto_now_add=True, db_index=True)),
                ('updated', models.DateTimeField(auto_now=True,
                                                 db_index=True)),
                ('sources', models.TextField(null=True)),
                ('document',
                 models.FileField(blank=True, null=True, upload_to=b'')),
                ('language',
                 models.CharField(choices=[('FRENCH', 'Fr'), ('ARABE', 'Ar'),
                                           ('ENGLISH', 'En')],
                                  default='ARABE',
                                  max_length=60)),
                ('published', models.BooleanField(default=False)),
            ],
            options={
                'ordering': ['-posted', '-updated'],
                'verbose_name_plural': 'articles',
            },
        ),
        migrations.CreateModel(
            name='Categorie',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(db_index=True, max_length=100)),
                ('slug', models.SlugField(max_length=100, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Images',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(upload_to=articles.models.upload_location,
                                   verbose_name='Image')),
                ('post',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='articles.Article')),
            ],
        ),
    ]