Example #1
0
class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='ScopedApplication',
            fields=[
                ('client_id',
                 models.CharField(
                     db_index=True,
                     default=oauth2_provider.generators.generate_client_id,
                     max_length=100,
                     unique=True)),
                ('redirect_uris',
                 models.TextField(
                     blank=True,
                     help_text='Allowed URIs list, space separated',
                     validators=[oauth2_provider.validators.validate_uris])),
                ('client_type',
                 models.CharField(choices=[('confidential', 'Confidential'),
                                           ('public', 'Public')],
                                  max_length=32)),
                ('authorization_grant_type',
                 models.CharField(choices=[
                     ('authorization-code', 'Authorization code'),
                     ('implicit', 'Implicit'),
                     ('password', 'Resource owner password-based'),
                     ('client-credentials', 'Client credentials')
                 ],
                                  max_length=32)),
                ('client_secret',
                 models.CharField(
                     blank=True,
                     db_index=True,
                     default=oauth2_provider.generators.generate_client_secret,
                     max_length=255)),
                ('name', models.CharField(blank=True, max_length=255)),
                ('skip_authorization', models.BooleanField(default=False)),
                ('id', models.IntegerField(primary_key=True, serialize=False)),
                ('scopes',
                 django_mysql.models.ListCharField(
                     models.CharField(max_length=32),
                     help_text=
                     'Comma-separated list of scopes that this application will be allowed to request.',
                     max_length=825,
                     size=25)),
                ('user',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='oauth_dispatch_scopedapplication',
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ScopedApplicationOrganization',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('short_name',
                 models.CharField(
                     help_text='The short_name of an existing Organization.',
                     max_length=255)),
                ('provider_type',
                 models.CharField(choices=[(u'content_org', 'Content Provider')
                                           ],
                                  default=u'content_org',
                                  max_length=32)),
                ('application',
                 models.ForeignKey(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='organizations',
                     to=settings.OAUTH2_PROVIDER_APPLICATION_MODEL)),
            ],
        ),
    ]
Example #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Author",
            fields=[
                ("id",
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name="ID")),
                ("first_name", models.CharField(max_length=36,
                                                verbose_name="名")),
                ("last_name", models.CharField(max_length=64,
                                               verbose_name="姓氏")),
                ("birthday",
                 models.DateField(blank=True, null=True, verbose_name="出生日期")),
                ("email",
                 models.EmailField(blank=True, max_length=254, null=True)),
                ("created_at",
                 models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      null=True,
                                      verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "作者",
                "verbose_name_plural": "作者",
            },
        ),
        migrations.CreateModel(
            name="Book",
            fields=[
                ("id",
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name="ID")),
                ("name", models.CharField(max_length=128, verbose_name="书名")),
                ("ISBN", models.CharField(max_length=64, verbose_name="ISBN")),
                ("publication_date",
                 models.DateTimeField(verbose_name="出版日期")),
                ("package_type",
                 models.IntegerField(choices=[(1, "平装"), (2, "精装")],
                                     verbose_name="包装类型")),
                ("publisher_id", models.IntegerField(verbose_name="出版社ID")),
                (
                    "author_ids",
                    django_mysql.models.ListCharField(
                        models.IntegerField(verbose_name="作者ID"),
                        max_length=128,
                        size=None,
                        verbose_name="作者ID列表"),
                ),
                ("created_at",
                 models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      null=True,
                                      verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "书籍",
                "verbose_name_plural": "书籍",
            },
        ),
        migrations.CreateModel(
            name="Publisher",
            fields=[
                ("id",
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name="ID")),
                ("name", models.CharField(max_length=128,
                                          verbose_name="出版社名称")),
                ("address",
                 models.CharField(max_length=128, verbose_name="出版社地址")),
                ("city", models.CharField(max_length=64, verbose_name="所在城市")),
                ("country", models.CharField(max_length=64,
                                             verbose_name="所在国家")),
                ("website", models.URLField(blank=True, null=True)),
                ("created_at",
                 models.DateTimeField(auto_now_add=True, verbose_name="创建时间")),
                ("updated_at",
                 models.DateTimeField(auto_now=True,
                                      null=True,
                                      verbose_name="更新时间")),
            ],
            options={
                "verbose_name": "出版社",
                "verbose_name_plural": "出版社",
            },
        ),
    ]