예제 #1
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        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,
                                          verbose_name='name')),
                ('title',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='title')),
                ('slug', models.SlugField(unique=True, verbose_name='slug')),
                ('description',
                 models.TextField(blank=True, verbose_name='description')),
                ('created',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='creation time')),
                ('genre',
                 models.PositiveSmallIntegerField(choices=[(1, 'collection'),
                                                           (2, 'tutorial')],
                                                  default=1,
                                                  verbose_name='genre')),
                ('status',
                 models.PositiveSmallIntegerField(blank=True,
                                                  choices=[(1, 'ongoing'),
                                                           (2, 'finished')],
                                                  null=True,
                                                  verbose_name='status')),
                ('cover',
                 models.ImageField(
                     blank=True,
                     upload_to='/static/covers/categories/%Y/%m/%d/',
                     verbose_name='cover')),
                ('cover_caption',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='cover caption')),
                ('resource',
                 models.URLField(blank=True, verbose_name='resource')),
                ('creator',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='creator')),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('status',
                 models.PositiveSmallIntegerField(choices=[(1, 'published'),
                                                           (2, 'draft'),
                                                           (3, 'hidden')],
                                                  default=2,
                                                  verbose_name='status')),
                ('title', models.CharField(max_length=255,
                                           verbose_name='title')),
                ('body', models.TextField(verbose_name='body')),
                ('excerpt',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='excerpt')),
                ('views',
                 models.PositiveIntegerField(default=0,
                                             editable=False,
                                             verbose_name='views')),
                ('pub_date',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='publication time')),
                ('created_time',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='creation time')),
                ('modified_time',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modification time')),
                ('cover',
                 models.ImageField(blank=True,
                                   upload_to=blog.models.post_cover_path,
                                   verbose_name='cover')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('category',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Category',
                                   verbose_name='category')),
            ],
            options={
                'ordering': ['-created_time'],
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100,
                                          verbose_name='name')),
            ],
        ),
        migrations.AddField(
            model_name='post',
            name='tags',
            field=models.ManyToManyField(blank=True,
                                         to='blog.Tag',
                                         verbose_name='tags'),
        ),
    ]
예제 #2
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        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)),
            ],
        ),
        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)),
                ('excerpt', models.TextField(null=True)),
                ('video', embed_video.fields.EmbedVideoField(null=True)),
                ('video_caption', models.CharField(max_length=100)),
                ('image',
                 models.ImageField(default='posts/default.jpg',
                                   upload_to=blog.models.user_directory_path)),
                ('image_caption',
                 models.CharField(default='Photo by Blog', max_length=100)),
                ('slug',
                 models.SlugField(max_length=250, unique_for_date='publish')),
                ('publish',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('content', models.TextField()),
                ('status',
                 models.CharField(choices=[('draft', 'Draft'),
                                           ('published', 'Published')],
                                  default='published',
                                  max_length=10)),
                ('like_count', models.BigIntegerField(default='0')),
                ('thumbsup', models.IntegerField(default='0')),
                ('thumbsdown', models.IntegerField(default='0')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='blog_posts',
                                   to=settings.AUTH_USER_MODEL)),
                ('category',
                 models.ForeignKey(default=1,
                                   on_delete=django.db.models.deletion.PROTECT,
                                   to='blog.Category')),
                ('favourites',
                 models.ManyToManyField(blank=True,
                                        default=None,
                                        related_name='favourite',
                                        to=settings.AUTH_USER_MODEL)),
                ('likes',
                 models.ManyToManyField(blank=True,
                                        default=None,
                                        related_name='like',
                                        to=settings.AUTH_USER_MODEL)),
                ('thumbs',
                 models.ManyToManyField(blank=True,
                                        default=None,
                                        related_name='thumbs',
                                        to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ('-publish', ),
            },
        ),
        migrations.CreateModel(
            name='Vote',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('vote', models.BooleanField(default=True)),
                ('post',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='postid',
                                   to='blog.Post')),
                ('user',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='userid',
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('content', models.TextField()),
                ('publish', models.DateTimeField(auto_now_add=True)),
                ('status', models.BooleanField(default=True)),
                ('lft', models.PositiveIntegerField(editable=False)),
                ('rght', models.PositiveIntegerField(editable=False)),
                ('tree_id',
                 models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(editable=False)),
                ('author',
                 models.ForeignKey(blank=True,
                                   default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='author',
                                   to=settings.AUTH_USER_MODEL)),
                ('parent',
                 mptt.fields.TreeForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='children',
                     to='blog.Comment')),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='blog.Post')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
예제 #3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('username',
                 models.CharField(max_length=30,
                                  unique=True,
                                  verbose_name='username')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active.Unselect this instead of deleting accounts',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', blog.models.UserManager()),
            ],
        ),
    ]
예제 #4
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=150, unique=True)),
                ('slug',
                 models.SlugField(default=blog.models.gen_slug,
                                  max_length=150,
                                  unique=True)),
                ('body', models.TextField(max_length=10000)),
                ('date_pub', models.DateTimeField(auto_now_add=True)),
                ('author',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-date_pub'],
            },
        ),
        migrations.CreateModel(
            name='PostComment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('comment',
                 models.TextField(help_text='Enter comment about blog here.',
                                  max_length=1000)),
                ('post_date', models.DateTimeField(auto_now_add=True)),
                ('author',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     to=settings.AUTH_USER_MODEL)),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Post')),
            ],
            options={
                'ordering': ['post_date'],
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=50)),
                ('slug',
                 models.SlugField(default=blog.models.gen_slug, unique=True)),
            ],
            options={
                'ordering': ['title'],
            },
        ),
        migrations.AddField(
            model_name='post',
            name='tags',
            field=models.ManyToManyField(related_name='posts', to='blog.Tag'),
        ),
    ]
예제 #5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0007_alter_validators_add_error_messages'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('username',
                 models.CharField(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=30,
                     unique=True,
                     validators=[
                         django.core.validators.RegexValidator(
                             '^[\\w.@+-]+$',
                             'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.'
                         )
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='last name')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('accesskey',
                 models.CharField(max_length=32,
                                  unique=True,
                                  validators=[blog.models.validate_authkey])),
                ('secretkey',
                 models.CharField(max_length=32,
                                  validators=[blog.models.validate_authkey])),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'abstract': False,
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Blog',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('tagline', models.TextField()),
            ],
        ),
        migrations.CreateModel(
            name='Entry',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('headline', models.CharField(max_length=255)),
                ('body_text', models.TextField()),
                ('pub_date', models.DateField(auto_now_add=True)),
                ('mod_date', models.DateField(auto_now=True)),
                ('number_comments', models.IntegerField()),
                ('scoring', models.DecimalField(decimal_places=2,
                                                max_digits=3)),
                ('blog',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Blog')),
                ('users', models.ManyToManyField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
예제 #6
0
class Migration(migrations.Migration):

    dependencies = [
        ('blog', '0009_auto_20201015_0929'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='article',
            options={
                'verbose_name': 'статья',
                'verbose_name_plural': 'статьи'
            },
        ),
        migrations.AlterModelOptions(
            name='tag',
            options={
                'verbose_name': 'тег',
                'verbose_name_plural': 'теги'
            },
        ),
        migrations.AlterField(
            model_name='article',
            name='article_id',
            field=models.CharField(
                max_length=200,
                unique=True,
                validators=[blog.models.validate_id],
                verbose_name='ID статьи для посетителями сайта'),
        ),
        migrations.AlterField(
            model_name='article',
            name='markdown_text',
            field=models.TextField(verbose_name='текст в формате markdown'),
        ),
        migrations.AlterField(
            model_name='article',
            name='preview',
            field=models.TextField(
                max_length=1024,
                verbose_name=
                'выдержка из статьи в формате markdown для предварительного просмотра'
            ),
        ),
        migrations.AlterField(
            model_name='article',
            name='publication_date',
            field=models.DateTimeField(
                verbose_name='дата и время публикации статьи'),
        ),
        migrations.AlterField(
            model_name='article',
            name='tags',
            field=models.ManyToManyField(to='blog.Tag', verbose_name='теги'),
        ),
        migrations.AlterField(
            model_name='tag',
            name='tag_id',
            field=models.CharField(
                max_length=200,
                unique=True,
                validators=[blog.models.validate_id],
                verbose_name='ID тега для посетителей сайта'),
        ),
        migrations.AlterField(
            model_name='tag',
            name='tag_name',
            field=models.CharField(max_length=200, verbose_name='тег'),
        ),
    ]
예제 #7
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Catalog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(db_index=True, max_length=150)),
                ('slug', models.SlugField(unique=True)),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
            ],
        ),
        migrations.CreateModel(
            name='Category_a_laptop',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('catalog', models.ManyToManyField(blank=True, related_name='a_laptop_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
            ],
        ),
        migrations.CreateModel(
            name='Category_Phone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('catalog', models.ManyToManyField(blank=True, related_name='phone_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
            ],
        ),
        migrations.CreateModel(
            name='Category_TV',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('catalog', models.ManyToManyField(blank=True, related_name='tv_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
            ],
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('price', models.FloatField()),
            ],
        ),
        migrations.CreateModel(
            name='Xiaomi',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('onnect', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('camera', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='xiaomi_phone_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_phone', models.ManyToManyField(blank=True, related_name='xiaomi_phone', to='blog.Category_Phone')),
                ('xiaomi_phone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_Phone')),
            ],
        ),
        migrations.CreateModel(
            name='Sony',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('screen', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('size', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='sony_tv_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_tv', models.ManyToManyField(blank=True, related_name='sony_tv', to='blog.Category_TV')),
                ('sonys_tv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_TV')),
            ],
        ),
        migrations.CreateModel(
            name='Samsung_TV',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('screen', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('size', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='samsung_tv_tv_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_tv', models.ManyToManyField(blank=True, related_name='samsung_tv_tv', to='blog.Category_TV')),
                ('samsungs_tv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_TV')),
            ],
        ),
        migrations.CreateModel(
            name='Samsung',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('camera', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='samsung_phone_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_phone', models.ManyToManyField(blank=True, related_name='samsung_phone', to='blog.Category_Phone')),
                ('samsung_phone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_Phone')),
            ],
        ),
        migrations.CreateModel(
            name='Panasonic',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('screen', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('size', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='panasonic_tv_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_tv', models.ManyToManyField(blank=True, related_name='panasonic_tv', to='blog.Category_TV')),
                ('panasonic_tv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_TV')),
            ],
        ),
        migrations.CreateModel(
            name='OrderItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Item')),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_date', models.DateTimeField(auto_now_add=True)),
                ('ordered_date', models.DateTimeField()),
                ('ordered', models.BooleanField(default=False)),
                ('items', models.ManyToManyField(to='blog.OrderItem')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Mac_OS',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('touch', models.CharField(blank=True, db_index=True, max_length=30)),
                ('weight', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('onnect', models.CharField(db_index=True, max_length=30)),
                ('thickness', models.CharField(db_index=True, max_length=30)),
                ('ssd', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='mac_os_a_laptop_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_a_laptop', models.ManyToManyField(blank=True, related_name='mac_os_a_laptop', to='blog.Category_a_laptop')),
                ('mac_a_laptop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_a_laptop')),
            ],
        ),
        migrations.CreateModel(
            name='LG',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('screen', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('size', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='lg_tv_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_tv', models.ManyToManyField(blank=True, related_name='lg_tv', to='blog.Category_TV')),
                ('lgs_tv', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_TV')),
            ],
        ),
        migrations.CreateModel(
            name='ASUS',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('touch', models.CharField(blank=True, db_index=True, max_length=30)),
                ('weight', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('onnect', models.CharField(db_index=True, max_length=30)),
                ('thickness', models.CharField(blank=True, db_index=True, max_length=30)),
                ('ssd', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('asus_a_laptop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_a_laptop')),
                ('catalog', models.ManyToManyField(blank=True, related_name='asus_a_laptop_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_a_laptop', models.ManyToManyField(blank=True, related_name='asus_a_laptop', to='blog.Category_a_laptop')),
            ],
        ),
        migrations.CreateModel(
            name='Apple',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('camera', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('apple_phone', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_Phone')),
                ('catalog', models.ManyToManyField(blank=True, related_name='apple_phone_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_phone', models.ManyToManyField(blank=True, related_name='apple_phone', to='blog.Category_Phone')),
            ],
        ),
        migrations.CreateModel(
            name='ACER',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('touch', models.CharField(blank=True, db_index=True, max_length=30)),
                ('weight', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('onnect', models.CharField(db_index=True, max_length=30)),
                ('thickness', models.CharField(db_index=True, max_length=30)),
                ('ssd', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(decimal_places=2, max_digits=5)),
                ('acer_a_laptop', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category_a_laptop')),
                ('catalog', models.ManyToManyField(blank=True, related_name='acer_a_laptop_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
                ('category_a_laptop', models.ManyToManyField(blank=True, related_name='acer_a_laptop', to='blog.Category_a_laptop')),
            ],
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('blog', '0004_auto_20210203_1101'),
    ]

    operations = [
        migrations.RenameField(
            model_name='bloguser',
            old_name='bookmark',
            new_name='bookmarked_articles',
        ),
        migrations.RenameField(
            model_name='bloguser',
            old_name='follow',
            new_name='followers',
        ),
        migrations.RemoveField(
            model_name='article',
            name='like',
        ),
        migrations.RemoveField(
            model_name='comment',
            name='like',
        ),
        migrations.AddField(
            model_name='article',
            name='user_liked',
            field=models.ManyToManyField(related_name='alikes',
                                         through='blog.ArticleLike',
                                         to='blog.BlogUser',
                                         verbose_name='پسند'),
        ),
        migrations.AddField(
            model_name='comment',
            name='uesr_liked',
            field=models.ManyToManyField(related_name='clikes',
                                         through='blog.CommentLike',
                                         to='blog.BlogUser',
                                         verbose_name='پسند'),
        ),
        migrations.AlterField(
            model_name='article',
            name='img_path',
            field=models.ImageField(upload_to='%Y/%m/%d/',
                                    verbose_name='محل ذخیره تصویر'),
        ),
        migrations.AlterField(
            model_name='article',
            name='pub_date',
            field=models.DateField(auto_now_add=True,
                                   verbose_name='تاریخ انتشار'),
        ),
        migrations.AlterField(
            model_name='bloguser',
            name='img_path',
            field=models.ImageField(
                upload_to=blog.models.BlogUser.user_directory_path,
                verbose_name='محل ذخیره عکس'),
        ),
        migrations.AlterField(
            model_name='comment',
            name='pub_date',
            field=models.DateField(auto_now_add=True,
                                   verbose_name='تاریخ انتشار'),
        ),
        migrations.AlterField(
            model_name='follow',
            name='author',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='follower',
                to='blog.BlogUser',
                verbose_name='نویسنده'),
        ),
        migrations.AlterField(
            model_name='follow',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='following',
                to='blog.BlogUser',
                verbose_name='کاربر'),
        ),
    ]
예제 #9
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='News',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(db_index=True,
                                  default='',
                                  max_length=1000,
                                  verbose_name='Заголовок')),
                ('description',
                 models.TextField(default='',
                                  max_length=3000,
                                  verbose_name='Содержание')),
                ('published_at',
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name='Дата создания')),
                ('updated_at',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='Дата редактирования')),
                ('is_active',
                 models.BooleanField(choices=[(False, 'Не активна'),
                                              (True, 'Активна')],
                                     default=True,
                                     verbose_name='Статус')),
                ('is_approved',
                 models.BooleanField(choices=[(False, 'Не одобрена'),
                                              (True, 'Одобрена')],
                                     default=False,
                                     verbose_name='Одобрение')),
                ('user',
                 models.ForeignKey(default=None,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='news',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Опубликовал')),
            ],
            options={
                'verbose_name': 'Новость',
                'verbose_name_plural': 'Новости',
                'db_table': 'news',
                'ordering': ['-published_at'],
                'permissions': (('approve_news', 'Может одобрять'), ),
            },
        ),
        migrations.CreateModel(
            name='Tags',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('tag',
                 models.CharField(default='',
                                  max_length=30,
                                  verbose_name='Тег')),
                ('news',
                 models.ManyToManyField(default=None,
                                        related_name='tags',
                                        to='blog.News',
                                        verbose_name='Новости')),
            ],
            options={
                'verbose_name': 'Тег',
                'verbose_name_plural': 'Теги',
                'db_table': 'tags',
            },
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('phone',
                 models.CharField(default='',
                                  max_length=30,
                                  verbose_name='Телефон')),
                ('city',
                 models.CharField(default='',
                                  max_length=30,
                                  verbose_name='Город')),
                ('photo',
                 models.ImageField(default=None,
                                   upload_to=blog.models.get_avatar_path,
                                   verbose_name='Аватар')),
                ('user',
                 models.OneToOneField(
                     default=None,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='profile',
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Профиль',
                'verbose_name_plural': 'Профили',
                'db_table': 'profiles',
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title',
                 models.CharField(db_index=True,
                                  default='',
                                  max_length=1000,
                                  verbose_name='Заголовок')),
                ('description',
                 models.TextField(default='',
                                  max_length=3000,
                                  verbose_name='Содержание')),
                ('published_at',
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name='Дата создания')),
                ('user',
                 models.ForeignKey(default=None,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='post',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Опубликовал')),
            ],
            options={
                'verbose_name': 'Запись',
                'verbose_name_plural': 'Записи',
                'db_table': 'posts',
                'ordering': ['-published_at'],
            },
        ),
        migrations.CreateModel(
            name='File',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('file',
                 models.ImageField(default=None,
                                   upload_to=blog.models.get_upload_path,
                                   verbose_name='Файл')),
                ('post',
                 models.ForeignKey(default=None,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='files',
                                   to='blog.Post',
                                   verbose_name='Запись')),
            ],
        ),
        migrations.CreateModel(
            name='Comments',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('description',
                 models.TextField(default='',
                                  max_length=3000,
                                  verbose_name='Текст комментария')),
                ('username',
                 models.CharField(default='',
                                  max_length=100,
                                  verbose_name='Имя пользователя')),
                ('news',
                 models.ForeignKey(default=None,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='blog.News',
                                   verbose_name='Новость')),
                ('user',
                 models.ForeignKey(default=None,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='user_comments',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Пользователь')),
            ],
            options={
                'verbose_name': 'Комментарий',
                'verbose_name_plural': 'Комментарии',
                'db_table': 'comments',
            },
        ),
    ]
예제 #10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0008_alter_user_username_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='MyUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('password', models.CharField(max_length=128, verbose_name='password')),
                ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')),
                ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
                ('username', models.CharField(max_length=30, unique=True, verbose_name='Логин')),
                ('rateable', models.BooleanField(default=True)),
                ('avatar', imagekit.models.fields.ProcessedImageField(blank=True, upload_to=blog.models.MyUser.user_directory_path, verbose_name='Аватар')),
                ('email', models.EmailField(max_length=254, unique=True)),
                ('is_active', models.BooleanField(default=True, verbose_name='Активен')),
                ('is_staff', models.BooleanField(default=False, verbose_name='Персонал')),
                ('moderated', models.BooleanField(default=False, verbose_name='Модерируется')),
                ('moderator', models.BooleanField(default=False, verbose_name='Модератор')),
                ('user_last_login', models.DateTimeField(auto_now=True)),
                ('date_joined', models.DateTimeField(auto_now_add=True)),
                ('can_post', models.BooleanField(default=True, verbose_name='Может добавлять посты')),
                ('can_comment', models.BooleanField(default=True, verbose_name='Может комментировать')),
                ('can_complain', models.BooleanField(default=True, verbose_name='Может жаловаться')),
                ('rating', models.FloatField(default=0.0, verbose_name='Рейтинг')),
                ('votes_amount', models.CharField(choices=[('U', 'Unlimited'), ('N', 'Normal'), ('B', 'Blocked')], default='N', max_length=1)),
                ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.Group', verbose_name='groups')),
            ],
            options={
                'verbose_name_plural': 'Пользователи',
            },
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30, unique=True)),
                ('description', models.TextField(max_length=400)),
                ('slug', models.CharField(blank=True, max_length=250, verbose_name='URL')),
                ('order', models.SmallIntegerField(blank=True, default=1)),
            ],
            options={
                'verbose_name_plural': 'categories',
                'ordering': ['order'],
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('text', models.TextField(max_length=3700)),
                ('removed', models.BooleanField(default=False)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('rating', models.FloatField(default=0.0, verbose_name='Рейтинг')),
                ('can_complain', models.BooleanField(default=True, verbose_name='Разрешено жаловаться')),
                ('lft', models.PositiveIntegerField(db_index=True, editable=False)),
                ('rght', models.PositiveIntegerField(db_index=True, editable=False)),
                ('tree_id', models.PositiveIntegerField(db_index=True, editable=False)),
                ('level', models.PositiveIntegerField(db_index=True, editable=False)),
                ('author', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('parent', mptt.fields.TreeForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='blog.Comment')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Complain',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('edited', models.DateTimeField(auto_now=True)),
                ('score', models.FloatField(blank=True, default=0, null=True)),
                ('users_complained', models.TextField(blank=True, default='{}', max_length=2000, null=True)),
                ('comment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='blog.Comment')),
            ],
            options={
                'verbose_name_plural': 'Жалобы',
                'ordering': ['edited'],
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('mform_type', models.CharField(blank=True, choices=[('Article', 'Статья'), ('SoftwareApplication', 'Приложение'), ('BlogPosting', 'Пост'), ('NewsArticle', 'Новость'), ('WebSite', 'Сайт')], max_length=30, null=True, verbose_name='Тип')),
                ('title', models.CharField(max_length=150, verbose_name='Заголовок')),
                ('private', models.BooleanField(default=False, verbose_name='NSFW')),
                ('rateable', models.BooleanField(default=True, verbose_name='Разрешено голосовать')),
                ('comments', models.BooleanField(default=True, verbose_name='Разрешено комментировать')),
                ('can_complain', models.BooleanField(default=True, verbose_name='Разрешено жаловаться')),
                ('locked', models.BooleanField(default=False, verbose_name='Не разрешать редактировать автору')),
                ('description', models.TextField(max_length=700, verbose_name='Описание')),
                ('text', models.TextField()),
                ('post_image', models.FileField(blank=True, max_length=500, null=True, upload_to='2017/3/31/', validators=[blog.functions.validate_post_image])),
                ('post_image_gif', models.FileField(blank=True, max_length=500, null=True, upload_to='2017/3/31/')),
                ('image_url', models.URLField(blank=True, max_length=1000, null=True)),
                ('main_image_srcset', models.TextField(blank=True, max_length=800, null=True)),
                ('post_thumbnail', models.ImageField(blank=True, max_length=500, null=True, upload_to='2017/3/31/')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('edited', models.DateTimeField(auto_now=True)),
                ('published', models.DateTimeField(default=django.utils.timezone.now)),
                ('rating', models.FloatField(default=0.0, verbose_name='Рейтинг')),
                ('url', models.CharField(blank=True, max_length=330)),
                ('status', models.CharField(choices=[('D', 'Черновик/удалён'), ('P', 'Опубликован')], default='D', max_length=1, verbose_name='Статус')),
                ('author', models.ForeignKey(default=1, on_delete=django.db.models.deletion.SET_DEFAULT, to=settings.AUTH_USER_MODEL)),
                ('category', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Category')),
            ],
            options={
                'verbose_name_plural': 'posts',
                'ordering': ['-published'],
            },
            bases=(meta.models.ModelMeta, models.Model),
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('url', models.CharField(max_length=140, unique=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('private', models.BooleanField(default=False)),
                ('rateable', models.BooleanField(default=True)),
                ('description', models.TextField(blank=True, max_length=700, null=True)),
                ('rating', models.FloatField(default=0.0, verbose_name='Рейтинг')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.Category')),
            ],
            options={
                'verbose_name_plural': 'Тэги',
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='UserVotes',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('votes_amount', models.IntegerField(default=10)),
                ('weight', models.FloatField(default=0.25)),
                ('vote_type', models.CharField(choices=[('U', 'Unlimited'), ('N', 'Normal'), ('B', 'Blocked')], default='N', max_length=1)),
                ('block_date', models.DateTimeField(blank=True, null=True)),
                ('manual', models.BooleanField(default=False)),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='post',
            name='main_tag',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.Tag'),
        ),
        migrations.AddField(
            model_name='post',
            name='tags',
            field=models.ManyToManyField(blank=True, related_name='posts', related_query_name='tag', to='blog.Tag'),
        ),
        migrations.AddField(
            model_name='complain',
            name='post',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='blog.Post'),
        ),
        migrations.AddField(
            model_name='comment',
            name='post',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.Post'),
        ),
        migrations.AddField(
            model_name='myuser',
            name='moderator_of_categories',
            field=models.ManyToManyField(blank=True, to='blog.Category', verbose_name='Модерирует категории'),
        ),
        migrations.AddField(
            model_name='myuser',
            name='moderator_of_tags',
            field=models.ManyToManyField(blank=True, to='blog.Tag', verbose_name='Модерирует тэги'),
        ),
        migrations.AddField(
            model_name='myuser',
            name='user_permissions',
            field=models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions'),
        ),
    ]
예제 #11
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='プログラミング',
                                  max_length=100,
                                  unique=True,
                                  verbose_name='カテゴリー名')),
                ('category_type',
                 models.IntegerField(choices=[(1, 'main'), (2, 'sub')],
                                     help_text='カテゴリーレベル',
                                     verbose_name='カテゴリーレベル')),
                ('slug',
                 models.SlugField(allow_unicode=True,
                                  blank=True,
                                  default='',
                                  max_length=100,
                                  null=True,
                                  unique=True)),
                ('parent_category',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='subcategories',
                                   to='blog.Category')),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=255,
                                  unique=True,
                                  verbose_name='タグ名')),
                ('slug',
                 models.SlugField(allow_unicode=True,
                                  blank=True,
                                  default='',
                                  max_length=255,
                                  null=True,
                                  unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=50,
                                           verbose_name='タイトル')),
                ('text', models.TextField(verbose_name='本文')),
                ('thumbnail',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='',
                                   verbose_name='サムネイル')),
                ('is_public',
                 models.BooleanField(default=True, verbose_name='公開可能か?')),
                ('likes', models.IntegerField(default=0, verbose_name='いいね')),
                ('description',
                 models.TextField(max_length=130,
                                  verbose_name='記事の説明(SEOのmeta関連)')),
                ('keywords',
                 models.CharField(default='Dart,Flutter',
                                  max_length=255,
                                  verbose_name='記事のキーワード(SEOのmeta関連)')),
                ('viewnumber',
                 models.IntegerField(
                     default=0,
                     validators=[django.core.validators.MinValueValidator(0)],
                     verbose_name='閲覧数')),
                ('created_at',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='作成日')),
                ('updated_at',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='更新日')),
                ('category',
                 models.ForeignKey(
                     blank=True,
                     default=blog.models.get_or_create_default_category,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='blog.Category',
                     verbose_name='カテゴリー')),
                ('relation_posts',
                 models.ManyToManyField(blank=True,
                                        related_name='_post_relation_posts_+',
                                        to='blog.Post',
                                        verbose_name='関連記事')),
                ('tags',
                 models.ManyToManyField(blank=True,
                                        to='blog.Tag',
                                        verbose_name='タグ')),
            ],
        ),
        migrations.CreateModel(
            name='Like',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('ip_address', models.GenericIPAddressField()),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='like',
                                   to='blog.Post')),
            ],
        ),
        migrations.CreateModel(
            name='Counter',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('ip_address', models.GenericIPAddressField()),
                ('access_at', models.DateField(auto_now_add=True)),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Post')),
            ],
        ),
    ]
예제 #12
0
class Migration(migrations.Migration):

    dependencies = [
        ('blog', '0003_auto_20180131_2021'),
    ]

    operations = [
        migrations.CreateModel(
            name='Img',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=100, verbose_name='图片名(描述)')),
                ('head_pic',
                 models.ImageField(upload_to='blog/', verbose_name='图片')),
                ('created',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='creation time')),
            ],
            options={
                'verbose_name_plural': '图片',
                'ordering': ['-created'],
                'verbose_name': '图片',
            },
        ),
        migrations.AlterModelOptions(
            name='category',
            options={
                'verbose_name': '类别',
                'verbose_name_plural': '类别'
            },
        ),
        migrations.AlterModelOptions(
            name='post',
            options={
                'ordering': ['-created_time'],
                'verbose_name': '文章',
                'verbose_name_plural': '文章'
            },
        ),
        migrations.AlterModelOptions(
            name='tag',
            options={
                'verbose_name': '标签',
                'verbose_name_plural': '标签'
            },
        ),
        migrations.AlterField(
            model_name='category',
            name='cover',
            field=models.ImageField(
                blank=True,
                upload_to='media/covers/categories/%Y/%m/%d/',
                verbose_name='封面(教程使用)'),
        ),
        migrations.AlterField(
            model_name='category',
            name='cover_caption',
            field=models.CharField(blank=True,
                                   max_length=255,
                                   verbose_name='封面标题(教程使用)'),
        ),
        migrations.AlterField(
            model_name='category',
            name='creator',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL,
                verbose_name='作者'),
        ),
        migrations.AlterField(
            model_name='category',
            name='description',
            field=models.TextField(blank=True, verbose_name='描述'),
        ),
        migrations.AlterField(
            model_name='category',
            name='genre',
            field=models.PositiveSmallIntegerField(choices=[(1, '普通'),
                                                            (2, '教程')],
                                                   default=1,
                                                   verbose_name='类型'),
        ),
        migrations.AlterField(
            model_name='category',
            name='name',
            field=models.CharField(max_length=100, verbose_name='名字'),
        ),
        migrations.AlterField(
            model_name='category',
            name='resource',
            field=models.URLField(blank=True, verbose_name='资源(废弃)'),
        ),
        migrations.AlterField(
            model_name='category',
            name='slug',
            field=models.SlugField(unique=True, verbose_name='英文名'),
        ),
        migrations.AlterField(
            model_name='category',
            name='status',
            field=models.PositiveSmallIntegerField(blank=True,
                                                   choices=[(1, '进行中'),
                                                            (2, '已完成')],
                                                   null=True,
                                                   verbose_name='状态(教程使用)'),
        ),
        migrations.AlterField(
            model_name='category',
            name='title',
            field=models.CharField(blank=True,
                                   max_length=255,
                                   verbose_name='标题'),
        ),
        migrations.AlterField(
            model_name='post',
            name='author',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL,
                verbose_name='作者'),
        ),
        migrations.AlterField(
            model_name='post',
            name='body',
            field=models.TextField(verbose_name='内容'),
        ),
        migrations.AlterField(
            model_name='post',
            name='category',
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='blog.Category',
                verbose_name='类别'),
        ),
        migrations.AlterField(
            model_name='post',
            name='cover',
            field=models.ImageField(blank=True,
                                    upload_to=blog.models.post_cover_path,
                                    verbose_name='封面'),
        ),
        migrations.AlterField(
            model_name='post',
            name='created_time',
            field=model_utils.fields.AutoCreatedField(
                default=django.utils.timezone.now,
                editable=False,
                verbose_name='创建时间'),
        ),
        migrations.AlterField(
            model_name='post',
            name='excerpt',
            field=models.CharField(blank=True,
                                   max_length=255,
                                   verbose_name='摘要'),
        ),
        migrations.AlterField(
            model_name='post',
            name='modified_time',
            field=model_utils.fields.AutoLastModifiedField(
                default=django.utils.timezone.now,
                editable=False,
                verbose_name='修改时间'),
        ),
        migrations.AlterField(
            model_name='post',
            name='pub_date',
            field=models.DateTimeField(blank=True,
                                       null=True,
                                       verbose_name='发布时间'),
        ),
        migrations.AlterField(
            model_name='post',
            name='status',
            field=models.PositiveSmallIntegerField(choices=[
                (1, '发布'), (2, '草稿'), (3, '隐藏'), (4, '秘密')
            ],
                                                   default=2,
                                                   verbose_name='状态'),
        ),
        migrations.AlterField(
            model_name='post',
            name='tags',
            field=models.ManyToManyField(blank=True,
                                         to='blog.Tag',
                                         verbose_name='标签'),
        ),
        migrations.AlterField(
            model_name='post',
            name='title',
            field=models.CharField(max_length=255, verbose_name='标题'),
        ),
        migrations.AlterField(
            model_name='post',
            name='views',
            field=models.PositiveIntegerField(default=0,
                                              editable=False,
                                              verbose_name='查看次数'),
        ),
        migrations.AlterField(
            model_name='tag',
            name='name',
            field=models.CharField(max_length=100, verbose_name='名字'),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('auth', '0007_alter_validators_add_error_messages'),
        ('tagging', '0003_adapt_max_tag_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('username',
                 models.CharField(
                     error_messages={
                         'unique': 'A user with that username already exists.'
                     },
                     help_text=
                     'Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=30,
                     unique=True,
                     validators=[
                         django.core.validators.RegexValidator(
                             '^[\\w.@+-]+$',
                             'Enter a valid username. This value may contain only letters, numbers and @/./+/-/_ characters.'
                         )
                     ],
                     verbose_name='username')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=30,
                                  verbose_name='last name')),
                ('email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='email address')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('name', models.CharField(max_length=12)),
                ('editor_choice',
                 models.CharField(default='tinyMCE', max_length=20)),
                ('avatar_path',
                 models.ImageField(default='/static/image/avatar_default.jpg',
                                   upload_to='/avatar')),
                ('wx_user_name', models.CharField(default='', max_length=80)),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'abstract': False,
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Carousel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('img', models.ImageField(upload_to='/carousel')),
                ('create_time', models.DateTimeField(auto_now_add=True)),
            ],
            options={
                'ordering': ['-create_time'],
            },
        ),
        migrations.CreateModel(
            name='Catalogue',
            fields=[
                ('name',
                 models.CharField(max_length=20,
                                  primary_key=True,
                                  serialize=False)),
            ],
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('publish_Time', models.DateTimeField(auto_now_add=True)),
                ('ip_address', models.GenericIPAddressField()),
                ('content', models.TextField()),
                ('root_id', models.IntegerField(default=0)),
                ('parent_id', models.IntegerField(default=0)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Content',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('menu_id', models.IntegerField(default=1)),
                ('content', models.TextField(default='')),
                ('content_type', models.SmallIntegerField(default=0)),
                ('publish_time', models.DateTimeField(auto_now_add=True)),
                ('modify_time', models.DateTimeField(auto_now=True)),
            ],
            options={
                'ordering': ['-modify_time'],
            },
        ),
        migrations.CreateModel(
            name='Docutype',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('publish_time', models.DateTimeField(auto_now_add=True)),
                ('modify_time', models.DateTimeField(auto_now=True)),
                ('is_deleted', models.SmallIntegerField(default=0)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'ordering': ['-modify_time'],
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('publish_time', models.DateTimeField(auto_now_add=True)),
                ('modify_time', models.DateTimeField(auto_now_add=True)),
                ('content', models.TextField()),
                ('tag', blog.models.TagField_Mine(blank=True, max_length=255)),
                ('view_count', models.IntegerField(default=0, editable=False)),
                ('status',
                 models.SmallIntegerField(choices=[(0, '\u8349\u7a3f'),
                                                   (1, '\u53d1\u5e03'),
                                                   (2, '\u5220\u9664')],
                                          default=0)),
                ('editor_choice', models.CharField(max_length=20)),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('catalogue',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Catalogue')),
            ],
            options={
                'ordering': ['-modify_time'],
            },
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('publish_time', models.DateTimeField(auto_now_add=True)),
                ('modify_time', models.DateTimeField(auto_now=True)),
                ('description', models.CharField(default='', max_length=255)),
                ('is_deleted', models.SmallIntegerField(default=0)),
                ('menu_json', models.TextField(default='')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('docutype',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Docutype')),
            ],
            options={
                'ordering': ['-modify_time'],
            },
        ),
        migrations.CreateModel(
            name='Repository',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('publish_time', models.DateTimeField(auto_now_add=True)),
                ('author', models.CharField(max_length=20)),
                ('content', models.TextField()),
                ('view_count', models.IntegerField(default=0, editable=False)),
                ('tag',
                 models.ManyToManyField(blank=True,
                                        default='',
                                        to='tagging.Tag')),
            ],
            options={
                'ordering': ['-publish_time'],
            },
        ),
        migrations.CreateModel(
            name='Wxfriends',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('user_id', models.IntegerField(default=1)),
                ('attr_id', models.CharField(default='', max_length=100)),
                ('user_name', models.CharField(default='', max_length=80)),
                ('nick_name', models.CharField(default='', max_length=255)),
                ('remark_name', models.CharField(default='', max_length=80)),
                ('province', models.CharField(default='', max_length=20)),
                ('city', models.CharField(default='', max_length=20)),
                ('sex', models.CharField(default='', max_length=3)),
                ('img', models.CharField(default='', max_length=255)),
                ('sign', models.CharField(default='', max_length=255)),
                ('contact_flag', models.CharField(default='', max_length=8)),
                ('sns_flag', models.CharField(default='', max_length=8)),
            ],
        ),
        migrations.CreateModel(
            name='Wxgroups',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('room_id', models.CharField(default='', max_length=100)),
                ('user_id', models.CharField(default='', max_length=10)),
                ('user_name', models.CharField(default='', max_length=80)),
                ('nick_name', models.CharField(default='', max_length=255)),
                ('remark_name', models.CharField(default='', max_length=80)),
                ('img', models.CharField(default='', max_length=255)),
            ],
        ),
        migrations.AddField(
            model_name='content',
            name='product',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='blog.Product'),
        ),
        migrations.AddField(
            model_name='comment',
            name='post',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to='blog.Post'),
        ),
        migrations.AddField(
            model_name='carousel',
            name='post',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to='blog.Post'),
        ),
    ]
예제 #14
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')),
                ('name', models.CharField(max_length=512, unique=True, verbose_name='Name')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('slug', models.CharField(blank=True, db_index=True, max_length=256, verbose_name='Slug')),
                ('title', models.CharField(blank=True, max_length=256, verbose_name='Title')),
                ('description', models.TextField(blank=True, max_length=1024, verbose_name='Description')),
                ('content', models.TextField(blank=True, verbose_name='Content')),
                ('published_date', models.DateTimeField(blank=True, null=True, verbose_name='Published')),
                ('published', models.NullBooleanField(verbose_name='Is published')),
                ('deleted', models.NullBooleanField(verbose_name='Is deleted')),
                ('author_name', models.CharField(blank=True, max_length=256, verbose_name='Author name')),
            ],
            options={
                'ordering': ['-created'],
                'verbose_name': 'Article',
                'verbose_name_plural': 'Articles',
            },
        ),
        migrations.CreateModel(
            name='ArticleList',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('read', models.BooleanField(default=False, verbose_name='Is read')),
                ('notified', models.NullBooleanField(verbose_name='Is notified')),
                ('article', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Article', verbose_name='Article')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='Subscriber')),
            ],
        ),
        migrations.CreateModel(
            name='Blog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=512, unique=True, verbose_name='Name')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('deleted', models.BooleanField(default=False, verbose_name='Is deleted')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CustomImage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('img', models.ImageField(upload_to=blog.models.get_avatar_path, verbose_name='Custom Image')),
            ],
        ),
        migrations.CreateModel(
            name='CustomUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('phone', models.CharField(max_length=32, verbose_name='Phone number')),
                ('skype', models.CharField(blank=True, max_length=128, null=True, verbose_name='Skype nick')),
                ('avatar', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.CustomImage', verbose_name='User avatar')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Mail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=512, unique=True, verbose_name='Name')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('sended', models.NullBooleanField(verbose_name='Is sent')),
                ('status', models.SmallIntegerField(default=1, verbose_name='Sending status')),
                ('to_addr', models.EmailField(max_length=254, verbose_name='Subscriber email address')),
                ('sending_date', models.DateTimeField(blank=True, null=True, verbose_name='Date of sending')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MailTemplate',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=512, unique=True, verbose_name='Name')),
                ('created', models.DateTimeField(auto_now_add=True, verbose_name='Created')),
                ('updated', models.DateTimeField(auto_now=True, verbose_name='Updated')),
                ('subject', models.CharField(max_length=128, verbose_name='Subject')),
                ('from_addr', models.EmailField(blank=True, max_length=254, verbose_name='Sender email address')),
                ('message', models.TextField(blank=True, verbose_name='Body')),
                ('slug', models.SlugField(help_text='Unique slug for internal usages.', unique=True, verbose_name='Slug')),
                ('num_of_retries', models.PositiveIntegerField(default=0, verbose_name='Number of retries')),
                ('interval', models.PositiveIntegerField(blank=True, help_text='Specify sending interval in the seconds.', null=True, verbose_name='Send interval')),
                ('default', models.BooleanField(default=False, verbose_name='Is default template')),
            ],
            options={
                'ordering': ['-created'],
                'verbose_name': 'Mail template',
                'verbose_name_plural': 'Mail templates',
            },
        ),
        migrations.AddField(
            model_name='blog',
            name='author',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='author', to='blog.CustomUser', verbose_name='Author'),
        ),
        migrations.AddField(
            model_name='blog',
            name='subscribers',
            field=models.ManyToManyField(blank=True, null=True, to='blog.CustomUser', verbose_name='Subscribed users'),
        ),
        migrations.AddField(
            model_name='article',
            name='blog',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='blog.Blog'),
        ),
    ]
예제 #15
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=30)),
                ('slug', models.SlugField(unique=True)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=100)),
                ('slug', models.SlugField(unique=True)),
                ('timestamp', models.DateTimeField(auto_now_add=True)),
            ],
        ),
        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)),
                ('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)),
                ('category',
                 models.ForeignKey(
                     default=blog.models.set_default_category,
                     on_delete=django.db.models.deletion.SET_DEFAULT,
                     to='blog.Category')),
                ('tags', models.ManyToManyField(blank=True, to='blog.Tag')),
            ],
        ),
        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')),
            ],
        ),
    ]
예제 #16
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('taggit', '0003_taggeditem_add_unique_index'),
        ('auth', '0012_alter_user_first_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='CustomUser',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('password',
                 models.CharField(max_length=128, verbose_name='password')),
                ('last_login',
                 models.DateTimeField(blank=True,
                                      null=True,
                                      verbose_name='last login')),
                ('is_superuser',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates that this user has all permissions without explicitly assigning them.',
                     verbose_name='superuser status')),
                ('first_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='first name')),
                ('last_name',
                 models.CharField(blank=True,
                                  max_length=150,
                                  verbose_name='last name')),
                ('is_staff',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Designates whether the user can log into this admin site.',
                     verbose_name='staff status')),
                ('is_active',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Designates whether this user should be treated as active. Unselect this instead of deleting accounts.',
                     verbose_name='active')),
                ('date_joined',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      verbose_name='date joined')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('username',
                 models.CharField(blank=True,
                                  max_length=50,
                                  null=True,
                                  unique=True)),
                ('groups',
                 models.ManyToManyField(
                     blank=True,
                     help_text=
                     'The groups this user belongs to. A user will get all permissions granted to each of their groups.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Group',
                     verbose_name='groups')),
                ('user_permissions',
                 models.ManyToManyField(
                     blank=True,
                     help_text='Specific permissions for this user.',
                     related_name='user_set',
                     related_query_name='user',
                     to='auth.Permission',
                     verbose_name='user permissions')),
            ],
            options={
                'verbose_name': 'user',
                'verbose_name_plural': 'users',
                'abstract': False,
            },
            managers=[
                ('objects', blog.models.UserManager()),
            ],
        ),
        migrations.CreateModel(
            name='Category',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('description', models.CharField(max_length=255)),
                ('slug',
                 models.CharField(blank=True, max_length=60, unique=True)),
                ('image',
                 cloudinary.models.CloudinaryField(blank=True,
                                                   max_length=255,
                                                   null=True,
                                                   verbose_name='image')),
            ],
            options={
                'verbose_name_plural': 'Categories',
            },
        ),
        migrations.CreateModel(
            name='Introduction',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=120)),
                ('message', tinymce.models.HTMLField()),
                ('status',
                 models.CharField(choices=[('A', 'Active'),
                                           ('I', 'In Active')],
                                  default='I',
                                  max_length=1)),
            ],
        ),
        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=120)),
                ('slug',
                 models.CharField(blank=True, max_length=60, unique=True)),
                ('content', tinymce.models.HTMLField()),
                ('status',
                 models.CharField(choices=[('D', 'Draft'), ('P', 'Publish')],
                                  max_length=1)),
                ('date', models.DateField(auto_now=True)),
                ('image',
                 cloudinary.models.CloudinaryField(max_length=255,
                                                   verbose_name='image')),
                ('author',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('category',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.category')),
                ('tags',
                 taggit.managers.TaggableManager(
                     blank=True,
                     help_text='A comma-separated list of tags.',
                     through='taggit.TaggedItem',
                     to='taggit.Tag',
                     verbose_name='Tags')),
            ],
            options={
                'ordering': ['-date'],
            },
        ),
        migrations.CreateModel(
            name='PostVideo',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('video_link',
                 models.CharField(blank=True, default='', max_length=600)),
                ('post',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.post')),
            ],
        ),
        migrations.CreateModel(
            name='PostImage',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('images',
                 cloudinary.models.CloudinaryField(max_length=255,
                                                   verbose_name='image')),
                ('description',
                 models.CharField(blank=True, default='', max_length=120)),
                ('post',
                 models.ForeignKey(default=None,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.post')),
            ],
        ),
    ]
예제 #17
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Catalog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(db_index=True, max_length=150)),
                ('slug', models.SlugField(unique=True)),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
            ],
        ),
        migrations.CreateModel(
            name='Category_a_laptop',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('catalog', models.ManyToManyField(blank=True, related_name='a_laptop_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
            ],
        ),
        migrations.CreateModel(
            name='Category_Phone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('catalog', models.ManyToManyField(blank=True, related_name='phone_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
            ],
        ),
        migrations.CreateModel(
            name='Category_TV',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('slug', models.SlugField(unique=True)),
                ('catalog', models.ManyToManyField(blank=True, related_name='tv_catalog', to='blog.Catalog')),
                ('catalogs', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='blog.Catalog')),
            ],
        ),
        migrations.CreateModel(
            name='Product_TV',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(blank=True, unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('screen', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('size', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(blank=True, decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='catalog_tv', to='blog.Catalog')),
                ('category_tv', models.ManyToManyField(blank=True, related_name='tv', to='blog.Category_TV')),
            ],
        ),
        migrations.CreateModel(
            name='Product_Phone',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(blank=True, unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('camera', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('connect', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(blank=True, decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='catalog_phone', to='blog.Catalog')),
                ('category_phone', models.ManyToManyField(blank=True, related_name='phone', to='blog.Category_Phone')),
            ],
        ),
        migrations.CreateModel(
            name='Product_a_laptop',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('image', models.ImageField(db_index=True, upload_to=blog.models.media)),
                ('slug', models.SlugField(blank=True, unique=True)),
                ('title', models.CharField(db_index=True, max_length=30)),
                ('touch', models.CharField(blank=True, db_index=True, max_length=30)),
                ('weight', models.CharField(db_index=True, max_length=30)),
                ('memory', models.CharField(db_index=True, max_length=30)),
                ('onnect', models.CharField(db_index=True, max_length=30)),
                ('thickness', models.CharField(db_index=True, max_length=30)),
                ('ssd', models.CharField(db_index=True, max_length=30)),
                ('decimal', models.DecimalField(blank=True, decimal_places=2, max_digits=5)),
                ('catalog', models.ManyToManyField(blank=True, related_name='catalog_a_laptop', to='blog.Catalog')),
                ('category_a_laptop', models.ManyToManyField(blank=True, related_name='a_laptop', to='blog.Category_a_laptop')),
            ],
        ),
    ]
예제 #18
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=100)),
                ('slug',
                 models.SlugField(
                     help_text='Uri identifier for this department.',
                     max_length=255,
                     verbose_name='Slug')),
                ('created', models.DateField(auto_now_add=True)),
                ('updated', models.DateField(auto_now=True)),
                ('text', models.TextField()),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ArticleFigures',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('order',
                 models.IntegerField(help_text='Figure display order.',
                                     max_length=255,
                                     verbose_name='Order')),
                ('article',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.Article',
                                   verbose_name='Article')),
            ],
            options={
                'verbose_name': 'Article Figure',
                'verbose_name_plural': 'Article Figures',
                'ordering': ['order'],
            },
        ),
        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)),
                ('image',
                 models.FileField(upload_to='categories',
                                  validators=[blog.models.validate_svg])),
                ('description', models.TextField()),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Figure',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image', models.ImageField(upload_to='figures')),
                ('caption', models.TextField(blank=True)),
            ],
        ),
        migrations.AddField(
            model_name='articlefigures',
            name='figure',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='blog.Figure',
                verbose_name='Figure'),
        ),
        migrations.AddField(
            model_name='article',
            name='category',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='blog.Category'),
        ),
        migrations.AddField(
            model_name='article',
            name='figures',
            field=models.ManyToManyField(help_text='Figures in this article.',
                                         related_name='figures',
                                         through='blog.ArticleFigures',
                                         to='blog.Figure',
                                         verbose_name='Figures'),
        ),
    ]