Exemplo n.º 1
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')),
                ('title', models.CharField(max_length=200)),
                ('image', models.ImageField(blank=True, upload_to=Blog.models.post_image)),
                ('text', models.TextField()),
                ('created_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('published_date', models.DateTimeField(blank=True, null=True)),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('author', models.CharField(max_length=200)),
                ('text', models.TextField()),
                ('created_date', models.DateTimeField(default=django.utils.timezone.now)),
                ('approved_comment', models.BooleanField(default=False)),
                ('post', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='comments', to='Blog.Post')),
            ],
        ),
    ]
Exemplo n.º 2
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('Blog', '0004_auto_20210410_0824'),
    ]

    operations = [
        migrations.CreateModel(
            name='Video',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=128)),
                ('description', models.TextField()),
                ('vid',
                 models.FileField(upload_to=Blog.models.user_directory_path)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('course',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='Blog.post')),
            ],
        ),
    ]
Exemplo n.º 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(blank=True, max_length=100, null=True)),
                ('slug', models.SlugField(default='old', unique=True)),
                ('image',
                 models.ImageField(blank=True,
                                   height_field='height_field',
                                   null=True,
                                   upload_to=Blog.models.upload_location,
                                   width_field='width_field')),
                ('height_field', models.IntegerField(default=50)),
                ('width_field', models.IntegerField(default=50)),
                ('content', models.TextField(blank=True)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
            ],
        ),
    ]
Exemplo n.º 4
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=Blog.models.get_image_filename)),
                ('name', models.CharField(blank=True, max_length=100)),
                ('owner',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('category',
                 models.CharField(choices=[('News', 'News'),
                                           ('Caving', 'Caving'),
                                           ('Training', 'Training'),
                                           ('Social', 'Social')],
                                  max_length=10)),
                ('title', models.CharField(max_length=200)),
                ('text', models.TextField()),
                ('published_date',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('images',
                 models.ManyToManyField(blank=True, null=True,
                                        to='Blog.Image')),
            ],
        ),
    ]
Exemplo n.º 5
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')),
                ('title',
                 models.CharField(max_length=250, verbose_name='Название')),
                ('slug',
                 models.SlugField(max_length=250,
                                  unique_for_date='published')),
                ('image',
                 models.ImageField(upload_to=Blog.models.generate_filename,
                                   verbose_name='Изображение')),
                ('body', models.TextField(verbose_name='Содержание')),
                ('text_min',
                 models.CharField(max_length=300,
                                  verbose_name='Краткое описание')),
                ('published',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('update', models.DateTimeField(auto_now=True)),
                ('likes',
                 models.PositiveIntegerField(default=0, verbose_name='Лайки')),
                ('dislikes',
                 models.PositiveIntegerField(default=0,
                                             verbose_name='Дизлайки')),
                ('status',
                 models.CharField(choices=[('draft', 'Draft'),
                                           ('published', 'Published')],
                                  default='draft',
                                  max_length=10)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='blog_posts',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-published', ),
            },
        ),
    ]
Exemplo n.º 6
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='BlogPost',
            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)),
                ('content', models.TextField()),
                ('created_on', models.DateTimeField(auto_now_add=True)),
                ('updated_on', models.DateTimeField(auto_now=True)),
                ('status',
                 models.IntegerField(choices=[(0, 'Draft'), (1, 'Publish')],
                                     default=0)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='blog_posts',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-created_on'],
            },
        ),
        migrations.CreateModel(
            name='Images',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=Blog.models.user_directory_path)),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='Blog.BlogPost')),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('body', models.TextField()),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('active', models.BooleanField(default=True)),
                ('name',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='blog_user',
                                   to=settings.AUTH_USER_MODEL)),
                ('parent',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='replies',
                                   to='Blog.Comment')),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments_on_blog',
                                   to='Blog.BlogPost')),
            ],
            options={
                'ordering': ('created', ),
            },
        ),
    ]