Пример #1
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Press',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('press_name', models.CharField(max_length=35, unique=True)),
            ],
            options={
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='Books',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('books_name', models.CharField(max_length=25)),
                ('publish_date', models.DateField(auto_now=True)),
                ('price',
                 models.DecimalField(decimal_places=2,
                                     default=0.0,
                                     max_digits=5)),
                ('stock', models.PositiveSmallIntegerField(default=50)),
                ('sales_num', models.PositiveIntegerField(default=0)),
                ('us_shelf', models.BooleanField(default=False)),
                ('press',
                 models.ForeignKey(
                     default=1,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='pb',
                     to='app01.Press')),
            ],
            options={
                'ordering': ['id'],
            },
        ),
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=35)),
                ('email', models.EmailField(default='', max_length=50)),
                ('number_id', app01.models.MyField(max_length=18)),
                ('bookss', models.ManyToManyField(to='app01.Books')),
            ],
        ),
    ]
Пример #2
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Person',
            fields=[
                ('pid', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, db_column='nick', max_length=32, null=True, unique=True, verbose_name='姓名')),
                ('age', models.IntegerField(default=18)),
                ('phone', app01.models.MyCharField(max_length=11, unique=True)),
                ('gender', models.BooleanField(choices=[(True, 'male'), (False, 'female')])),
                ('birth', models.DateTimeField(auto_now=True)),
            ],
        ),
        migrations.CreateModel(
            name='Xx',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('age', models.IntegerField(default=18)),
            ],
        ),
    ]
Пример #3
0
class User(models.Model):

    username = models.CharField(max_length=16)
    email = models.EmailField()

    def __str__(self):
        return self.username
Пример #4
0
class Migration(migrations.Migration):

    dependencies = [
        ('app01', '0012_auto_20191015_1501'),
    ]

    operations = [
        migrations.CreateModel(
            name='PersonDetail',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('addr', models.CharField(max_length=128)),
                ('phone', models.CharField(default='19983491093',
                                           max_length=11)),
            ],
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('hobby',
                 app01.models.FixedCharField(default='羽毛球', max_length=64)),
                ('birthday', models.DateField(auto_now_add=True)),
                ('detail',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='app01.PersonDetail')),
            ],
        ),
    ]
Пример #5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='test',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=32)),
                ('test', app01.models.MyCharField(max_length=32)),
            ],
        ),
    ]
Пример #6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Author',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=64, verbose_name='姓名')),
                ('sex', models.IntegerField(choices=[(1, '男'), (2, '女')], verbose_name='性别')),
            ],
        ),
        migrations.CreateModel(
            name='PersonDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('addr', models.CharField(max_length=128)),
                ('phone', models.CharField(default='19983491093', max_length=11)),
            ],
        ),
        migrations.CreateModel(
            name='Publisher',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False)),
                ('name', models.CharField(max_length=64, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Person',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=64)),
                ('hobby', app01.models.FixedCharField(default='羽毛球', max_length=64)),
                ('birthday', models.DateField(auto_now_add=True)),
                ('detail', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='app01.PersonDetail')),
            ],
        ),
        migrations.CreateModel(
            name='Book',
            fields=[
                ('id', models.AutoField(primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=64, unique=True, verbose_name='书名')),
                ('price', models.DecimalField(decimal_places=2, default=99.99, max_digits=5)),
                ('kucun', models.IntegerField(default=1000, verbose_name='库存')),
                ('maichu', models.IntegerField(default=10, verbose_name='卖出')),
                ('author', models.ManyToManyField(to='app01.Author')),
                ('publisher', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='books', to='app01.Publisher')),
            ],
        ),
    ]
Пример #7
0
class Migration(migrations.Migration):

    dependencies = [
        ('auth', '0011_update_proxy_permissions'),
        ('app01', '0001_initial'),
    ]

    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')),
                ('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')),
                ('username',
                 models.CharField(max_length=50,
                                  unique=True,
                                  verbose_name='username')),
                ('email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('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', app01.models.Manager()),
            ],
        ),
    ]