コード例 #1
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='user_profile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('bio', models.CharField(blank=True, max_length=150)),
                ('profile_pic',
                 models.ImageField(blank=True,
                                   upload_to=app_users.models.path_and_rename,
                                   verbose_name='Profile_Picture')),
                ('user_type',
                 models.CharField(choices=[('teacher', 'teacher'),
                                           ('student', 'student'),
                                           ('parent', 'parent')],
                                  default='student',
                                  max_length=10)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
コード例 #2
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='UserProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('middlename',
                 models.CharField(blank=True, max_length=50, null=True)),
                ('phone', models.CharField(blank=True,
                                           max_length=50,
                                           null=True)),
                ('photo',
                 models.ImageField(blank=True,
                                   max_length=1000,
                                   null=True,
                                   upload_to=app_users.models.only_filename)),
                ('user',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('app_users', '0001_initial'),
    ]

    operations = [
        migrations.AddField(
            model_name='userprofileinfo',
            name='profile_pic',
            field=models.ImageField(blank=True, upload_to=app_users.models.path_and_rename, verbose_name='Profile Picture'),
        ),
    ]