Beispiel #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=250)),
            ],
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=1000)),
                ('content', models.TextField()),
                ('author', models.ForeignKey(on_delete=models.SET(blog.models.get_sentinel_user), to=settings.AUTH_USER_MODEL)),
                ('category', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='blog.Category')),
            ],
        ),
        migrations.RunPython(forward_category, reverse_code=reverse_category)
    ]
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('blog', '0007_auto_20200507_0953'),
    ]

    operations = [
        migrations.AlterField(
            model_name='article',
            name='auteur',
            field=models.ForeignKey(on_delete=models.SET(
                blog.models.get_deleted_user),
                                    to=settings.AUTH_USER_MODEL,
                                    verbose_name='Auteur'),
        ),
        migrations.AlterField(
            model_name='article',
            name='content',
            field=models.TextField(null=True, verbose_name='Contenu'),
        ),
        migrations.AlterField(
            model_name='article',
            name='titre',
            field=models.CharField(max_length=255,
                                   verbose_name="Titre de l'article"),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='DivePost',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=100)),
                ('dive_site', models.CharField(blank=True, max_length=100)),
                ('content', models.TextField()),
                ('date_posted',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('diver',
                 models.ForeignKey(on_delete=models.SET(
                     blog.models.get_sentinel_user),
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Beispiel #4
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='SideBar',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=50, verbose_name='标题')),
                ('display_type', models.PositiveIntegerField(choices=[(1, 'HTML'), (2, '最新文章'), (3, '最热文章'), (4, '最近评论')], default=1, verbose_name='展示类型')),
                ('content', models.CharField(blank=True, help_text='如果设置的不是HTML类型,可为空', max_length=500, verbose_name='内容')),
                ('status', models.PositiveIntegerField(choices=[(1, '展示'), (0, '隐藏')], default=1, verbose_name='状态')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('owner', models.ForeignKey(on_delete=models.SET(blog.models.get_default_user), to=settings.AUTH_USER_MODEL, verbose_name='作者')),
            ],
            options={
                'verbose_name': '侧边栏',
                'verbose_name_plural': '侧边栏',
            },
        ),
        migrations.CreateModel(
            name='Link',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=50, verbose_name='标题')),
                ('href', models.URLField(verbose_name='链接')),
                ('status', models.PositiveIntegerField(choices=[(1, '正常'), (0, '删除')], default=1, verbose_name='状态')),
                ('weight', models.PositiveIntegerField(choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)], default=1, help_text='权重高展示顺序靠前', verbose_name='权重')),
                ('created_time', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('owner', models.ForeignKey(on_delete=models.SET(blog.models.get_default_user), to=settings.AUTH_USER_MODEL, verbose_name='作者')),
            ],
            options={
                'verbose_name': '友链',
                'verbose_name_plural': '友链',
            },
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('blog', '0010_auto_20210226_1130'),
    ]

    operations = [
        migrations.AlterField(
            model_name='post',
            name='category',
            field=models.ForeignKey(default=1, on_delete=models.SET(blog.models.get_patent), to='blog.category', verbose_name='دسته\u200cبندی'),
            preserve_default=False,
        ),
    ]
Beispiel #6
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('blog', '0001_initial'),
    ]

    operations = [
        migrations.AlterModelOptions(
            name='entry',
            options={
                'ordering': ['-created'],
                'verbose_name': 'Postare din Blog',
                'verbose_name_plural': 'Postari din Blog'
            },
        ),
        migrations.AlterModelOptions(
            name='tag',
            options={'verbose_name_plural': 'Tag-uri'},
        ),
        migrations.AddField(
            model_name='entry',
            name='author',
            field=models.ForeignKey(default=0,
                                    on_delete=models.SET(
                                        blog.models.get_sentinel_user),
                                    to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='entry',
            name='image',
            field=models.ImageField(blank=True, upload_to='postImage'),
        ),
        migrations.AlterField(
            model_name='entry',
            name='created',
            field=models.DateTimeField(),
        ),
    ]
Beispiel #7
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=50, verbose_name='名称')),
                ('status',
                 models.PositiveIntegerField(choices=[(1, '正常'), (0, '删除')],
                                             default=1,
                                             verbose_name='状态')),
                ('is_nav',
                 models.BooleanField(default=False, verbose_name='是否为导航')),
                ('created_time',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('owner',
                 models.ForeignKey(on_delete=models.SET(
                     blog.models.get_default_user),
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='作者')),
            ],
            options={
                'verbose_name': '分类',
                'verbose_name_plural': '分类',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=10, verbose_name='名称')),
                ('status',
                 models.PositiveIntegerField(choices=[(1, '正常'), (0, '删除')],
                                             default=1,
                                             verbose_name='状态')),
                ('created_time',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('owner',
                 models.ForeignKey(on_delete=models.SET(
                     blog.models.get_default_user),
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='作者')),
            ],
            options={
                'verbose_name': '标签',
                'verbose_name_plural': '标签',
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=255, verbose_name='标题')),
                ('desc',
                 models.CharField(blank=True,
                                  max_length=1024,
                                  verbose_name='摘要')),
                ('content',
                 models.TextField(help_text='正文必须为MarkDown格式',
                                  verbose_name='正文')),
                ('status',
                 models.PositiveIntegerField(choices=[(1, '正常'), (0, '删除'),
                                                      (2, '草稿')],
                                             default=1,
                                             verbose_name='状态')),
                ('created_time',
                 models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('category',
                 models.ForeignKey(on_delete=models.SET(
                     blog.models.get_default_category),
                                   to='blog.Category',
                                   verbose_name='分类')),
                ('owner',
                 models.ForeignKey(on_delete=models.SET(
                     blog.models.get_default_user),
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='作者')),
                ('tag', models.ManyToManyField(to='blog.Tag',
                                               verbose_name='标签')),
            ],
            options={
                'verbose_name': '文章',
                'verbose_name_plural': '文章',
                'ordering': ['-id'],
            },
        ),
    ]
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='BlogUser',
            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. 150 characters or fewer. Letters, digits and @/./+/-/_ only.',
                     max_length=150,
                     unique=True,
                     validators=[
                         django.contrib.auth.validators.
                         UnicodeUsernameValidator()
                     ],
                     verbose_name='username')),
                ('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')),
                ('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')),
                ('phone_number',
                 models.CharField(blank=True,
                                  max_length=11,
                                  validators=[
                                      django.core.validators.RegexValidator(
                                          message='شماره تلفن وارد کنید',
                                          regex='0[1-9][0-9]{9}')
                                  ],
                                  verbose_name='شماره تلفن')),
                ('position',
                 models.CharField(blank=True,
                                  choices=[('normal', 'ساده'),
                                           ('writer', 'نویسنده'),
                                           ('editor', 'ویراستار'),
                                           ('manager', 'مدیر')],
                                  default='normal',
                                  max_length=8,
                                  verbose_name='رده کاربر')),
                ('image',
                 models.ImageField(blank=True,
                                   upload_to=blog.models.profile_user_path,
                                   verbose_name='تصویر پروفایل')),
                ('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': 'وبلاگ نویس',
                'verbose_name_plural': 'وبلاگ نویسان',
            },
            managers=[
                ('objects', django.contrib.auth.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=80,
                                  unique=True,
                                  verbose_name='دسته\u200cبندی')),
                ('parent',
                 models.ForeignKey(blank=True,
                                   null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.category',
                                   verbose_name='زیر مجموعه')),
            ],
            options={
                'verbose_name': 'دسته\u200cبندی',
                'verbose_name_plural': 'دسته\u200cبندی\u200cها',
            },
        ),
        migrations.CreateModel(
            name='Tag',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=80, verbose_name='تگ')),
            ],
            options={
                'verbose_name': 'تگ',
                'verbose_name_plural': 'تگ\u200cها',
            },
        ),
        migrations.CreateModel(
            name='Post',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.TextField(verbose_name='متن')),
                ('is_accepted',
                 models.BooleanField(choices=[(False, 'تایید نمی\u200cکنم'),
                                              (True, 'تایید می\u200cکنم')],
                                     default=False,
                                     verbose_name='تایید کردن')),
                ('is_activated',
                 models.BooleanField(choices=[(False, 'غیرفعال'),
                                              (True, 'فعال')],
                                     default=False,
                                     verbose_name='وضعیت فعالیت')),
                ('create_datetime',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='زمان ایجاد')),
                ('like_qty',
                 models.IntegerField(default=0, verbose_name='تعداد پسندیدن')),
                ('dislike_qty',
                 models.IntegerField(default=0,
                                     verbose_name='تعداد نپسندیدن')),
                ('title', models.CharField(max_length=80,
                                           verbose_name='عنوان')),
                ('image',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to=blog.models.post_user_path,
                                   verbose_name='تصویر پست')),
                ('category',
                 models.ForeignKey(on_delete=models.SET(
                     blog.models.get_patent),
                                   to='blog.category',
                                   verbose_name='دسته\u200cبندی')),
                ('creator',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='نویسنده')),
                ('tags',
                 models.ManyToManyField(blank=True,
                                        to='blog.Tag',
                                        verbose_name='تگ\u200cها')),
            ],
            options={
                'verbose_name': 'پست',
                'verbose_name_plural': 'پست\u200cها',
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.TextField(verbose_name='متن')),
                ('is_accepted',
                 models.BooleanField(choices=[(False, 'تایید نمی\u200cکنم'),
                                              (True, 'تایید می\u200cکنم')],
                                     default=False,
                                     verbose_name='تایید کردن')),
                ('is_activated',
                 models.BooleanField(choices=[(False, 'غیرفعال'),
                                              (True, 'فعال')],
                                     default=False,
                                     verbose_name='وضعیت فعالیت')),
                ('create_datetime',
                 models.DateTimeField(auto_now_add=True,
                                      verbose_name='زمان ایجاد')),
                ('like_qty',
                 models.IntegerField(default=0, verbose_name='تعداد پسندیدن')),
                ('dislike_qty',
                 models.IntegerField(default=0,
                                     verbose_name='تعداد نپسندیدن')),
                ('creator',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='نویسنده')),
                ('post',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='blog.post',
                                   verbose_name='پست')),
            ],
            options={
                'verbose_name': 'کامنت',
                'verbose_name_plural': 'کامنت\u200cها',
            },
        ),
        migrations.CreateModel(
            name='Like',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('value',
                 models.IntegerField(choices=[(0, 'null'), (1, 'like'),
                                              (-1, 'dislike')],
                                     default=0,
                                     verbose_name='مقدار')),
                ('post',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='blog.post',
                     verbose_name='پست')),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='وبلاگ نویس')),
            ],
            options={
                'verbose_name': 'لایک',
                'verbose_name_plural': 'لایک\u200cها',
                'unique_together': {('user', 'post')},
            },
        ),
    ]