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

    initial = True

    dependencies = [
        ('login_registration', '0002_auto_20190827_0824'),
    ]

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('image',
                 models.ImageField(
                     blank=True,
                     max_length=255,
                     null=True,
                     upload_to=apps.images.models.path_and_rename)),
                ('created_at', models.DateTimeField(auto_now_add=True)),
                ('updated_at', models.DateTimeField(auto_now=True)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='images',
                                   to='login_registration.User')),
            ],
        ),
    ]
コード例 #2
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(blank=True,
                                           max_length=50,
                                           null=True)),
                ('alt_text',
                 models.CharField(blank=True, max_length=120, null=True)),
                ('description',
                 models.CharField(blank=True, max_length=300, null=True)),
                ('slug', models.SlugField(max_length=250, unique=True)),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated', models.DateTimeField(auto_now=True)),
                ('image',
                 models.ImageField(
                     blank=True,
                     null=True,
                     upload_to=apps.images.models.image_upload_location)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
コード例 #3
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('slug', models.SlugField(blank=True, max_length=200)),
                ('url', models.URLField()),
                ('image',
                 models.ImageField(upload_to=apps.images.models.upload_path)),
                ('description', models.TextField(blank=True)),
                ('created', models.DateField(auto_now_add=True,
                                             db_index=True)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='images_created',
                                   to=settings.AUTH_USER_MODEL)),
                ('users_like',
                 models.ManyToManyField(blank=True,
                                        related_name='images_liked',
                                        to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
コード例 #4
0
ファイル: 0001_initial.py プロジェクト: bdrumheller/api_v2
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('samples', '0003_auto_20180220_0409'),
        ('chemical_analyses', '0004_auto_20180220_0409'),
    ]

    operations = [
        migrations.CreateModel(
            name='Image',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('image', versatileimagefield.fields.VersatileImageField(blank=True, null=True, upload_to=apps.images.models.Image.generate_filename, verbose_name='Image')),
                ('version', models.IntegerField(default=0)),
                ('collector', models.CharField(blank=True, max_length=50)),
                ('public_data', models.BooleanField(default=False)),
                ('chemical_analysis', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='image', to='chemical_analyses.ChemicalAnalysis')),
            ],
            options={
                'ordering': ('id',),
                'db_table': 'images',
            },
        ),
        migrations.CreateModel(
            name='ImageContainer',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('description', models.CharField(blank=True, max_length=100, null=True)),
                ('url', models.CharField(blank=True, max_length=500, null=True)),
            ],
            options={
                'ordering': ('id',),
                'db_table': 'image_container',
            },
        ),
        migrations.CreateModel(
            name='ImageType',
            fields=[
                ('id', models.SmallIntegerField(primary_key=True, serialize=False)),
                ('image_type', models.CharField(max_length=100)),
                ('abbreviation', models.CharField(max_length=10)),
                ('comments', models.CharField(max_length=250)),
            ],
        ),
        migrations.AddField(
            model_name='image',
            name='image_container',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='images', to='images.ImageContainer'),
        ),
        migrations.AddField(
            model_name='image',
            name='image_type_id',
            field=models.ForeignKey(blank=True, default='', on_delete=django.db.models.deletion.CASCADE, to='images.ImageType'),
        ),
        migrations.AddField(
            model_name='image',
            name='owner',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='images', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='image',
            name='sample',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='image', to='samples.Sample'),
        ),
        migrations.AddField(
            model_name='image',
            name='subsample',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='image', to='samples.Subsample'),
        ),
    ]
コード例 #5
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Collection',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('add_time',
                 models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '我的收藏',
                'verbose_name_plural': '我的收藏',
            },
        ),
        migrations.CreateModel(
            name='ImageCategory',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  help_text='类别名',
                                  max_length=30,
                                  verbose_name='类别名')),
                ('desc',
                 models.TextField(default='',
                                  help_text='类别描述',
                                  verbose_name='类别描述')),
                ('add_time',
                 models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
            ],
            options={
                'verbose_name': '图片类别',
                'verbose_name_plural': '图片类别',
            },
        ),
        migrations.CreateModel(
            name='Images',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  max_length=20,
                                  verbose_name='图片名称')),
                ('desc',
                 models.TextField(default='',
                                  help_text='图片描述',
                                  verbose_name='图片描述')),
                ('image',
                 models.ImageField(
                     upload_to=apps.images.models.user_directory_path,
                     verbose_name='图片')),
                ('click_num', models.IntegerField(default=0,
                                                  verbose_name='点击数')),
                ('add_time',
                 models.DateTimeField(auto_now_add=True, verbose_name='添加时间')),
                ('image_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='images.ImageCategory',
                                   verbose_name='图片类型')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='归属用户')),
            ],
            options={
                'verbose_name': '图片',
                'verbose_name_plural': '图片',
            },
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(default='',
                                  max_length=50,
                                  verbose_name='位置名称')),
                ('address',
                 models.CharField(default='',
                                  max_length=100,
                                  verbose_name='详细地址')),
                ('latitude', models.FloatField(default=0, verbose_name='纬度')),
                ('longitude', models.FloatField(default=0, verbose_name='经度')),
                ('add_time',
                 models.DateTimeField(auto_now=True, verbose_name='最近获取时间')),
                ('image',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to='images.Images',
                     verbose_name='归属图片')),
                ('user',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='归属用户')),
            ],
            options={
                'verbose_name': '地理位置',
                'verbose_name_plural': '地理位置',
            },
        ),
        migrations.AddField(
            model_name='collection',
            name='image',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='images.Images',
                verbose_name='收藏的图片'),
        ),
        migrations.AddField(
            model_name='collection',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to=settings.AUTH_USER_MODEL,
                verbose_name='归属用户'),
        ),
    ]