Exemple #1
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['profile', 'profile_liked'],
                                 name='unique_likes')
     ]
Exemple #2
0
 class Meta:
     constraints = [
         models.UniqueConstraint(
             fields=['user', 'author'], name='unique_subscription')
     ]
Exemple #3
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['owner', 'post'],
                                 name='only_like_constraint'),
     ]
Exemple #4
0
 class Meta:
     db_table = 'follow'
     constraints = [
         models.UniqueConstraint(fields=['from_user', 'to_user'],
                                 name='unique follow')
     ]
Exemple #5
0
 class Meta:
     constraints = [
         models.UniqueConstraint(
             fields=['user', 'recipe'], name='unique_position')
     ]
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['user', 'role', 'section_id'],
                                 name='unique_enrollment')
     ]
Exemple #7
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['course_id', 'user_id'],
                                 name='unique_role')
     ]
Exemple #8
0
 class Meta:
     db_table = 'log_activity_tokens'
     constraints = [
         models.UniqueConstraint(fields=('version', 'user'),
                                 name='version_id'),
     ]
Exemple #9
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['paper', 'type'],
                                 name='Paper and Type')
     ]
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['user', 'experiment_session_day'], name='unique_ESDU')
     ]        
     verbose_name = 'Experiment Session Day Users'
     verbose_name_plural = 'Experiment Session Day Users'
Exemple #11
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['student', 'disserta'],
                                 name='report')
     ]
class Migration(migrations.Migration):

    dependencies = [
        ("base", "0001_squashed_0154_auto_20200206_1736"),
    ]

    operations = [
        migrations.AlterField(
            model_name="permissionchangelog",
            name="performed_by",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="changed_permissions_log",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="permissionchangelog",
            name="performed_on",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="permisions_log",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="project",
            name="contact",
            field=models.ForeignKey(
                blank=True,
                help_text="\n        L10n driver in charge of the project\n    ",
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="contact_for",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="translation",
            name="approved_user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="approved_translations",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="translation",
            name="rejected_user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="rejected_translations",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="translation",
            name="unapproved_user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="unapproved_translations",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="translation",
            name="unrejected_user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="unrejected_translations",
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.AlterField(
            model_name="translation",
            name="user",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to=settings.AUTH_USER_MODEL,
            ),
        ),
        migrations.RemoveIndex(
            model_name="translation", name="base_transl_entity__fbea1e_partial",
        ),
        migrations.RemoveIndex(
            model_name="translation", name="base_transl_entity__ed9592_partial",
        ),
        migrations.AddConstraint(
            model_name="translation",
            constraint=models.UniqueConstraint(
                condition=models.Q(active=True),
                fields=("entity", "locale", "plural_form", "active"),
                name="entity_locale_plural_form_active",
            ),
        ),
        migrations.AddConstraint(
            model_name="translation",
            constraint=models.UniqueConstraint(
                condition=models.Q(("active", True), ("plural_form__isnull", True)),
                fields=("entity", "locale", "active"),
                name="entity_locale_active",
            ),
        ),
        migrations.AlterField(
            model_name="translationmemoryentry",
            name="project",
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="memory_entries",
                to="base.Project",
            ),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Artist',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, unique=True)),
            ],
        ),
        migrations.CreateModel(
            name='Badge',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50)),
                ('description', models.CharField(max_length=200)),
                ('number_notes', models.PositiveSmallIntegerField()),
            ],
        ),
        migrations.CreateModel(
            name='Show',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('show_date', models.DateTimeField()),
                ('artist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lmn.artist')),
            ],
        ),
        migrations.CreateModel(
            name='Venue',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, unique=True)),
                ('city', models.CharField(max_length=200)),
                ('state', models.CharField(max_length=2)),
            ],
        ),
        migrations.CreateModel(
            name='ShowRating',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('rating_out_of_five', models.PositiveIntegerField(blank=True, validators=[django.core.validators.MaxValueValidator(5), django.core.validators.MinValueValidator(1)])),
                ('show', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='ratings', to='lmn.show')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddField(
            model_name='show',
            name='venue',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lmn.venue'),
        ),
        migrations.CreateModel(
            name='Profile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('profile_image', models.ImageField(blank=True, null=True, upload_to='user_profile_images/')),
                ('bio', models.TextField(blank=True, null=True)),
                ('badges', models.ManyToManyField(blank=True, to='lmn.Badge')),
                ('shows_seen', models.ManyToManyField(blank=True, to='lmn.Show')),
                ('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Note',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=200)),
                ('text', models.TextField(max_length=1000)),
                ('posted_date', models.DateTimeField(auto_now_add=True)),
                ('image', models.ImageField(blank=True, null=True, upload_to='user_images/')),
                ('show', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='lmn.show')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.AddConstraint(
            model_name='showrating',
            constraint=models.UniqueConstraint(fields=('show', 'user'), name='user_rated_show'),
        ),
        migrations.AlterUniqueTogether(
            name='show',
            unique_together={('show_date', 'artist', 'venue')},
        ),
        migrations.AddConstraint(
            model_name='note',
            constraint=models.UniqueConstraint(fields=('show', 'user'), name='user_note_for_show'),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='AutomatizationRequest',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('step', models.IntegerField(blank=True, null=True)),
                ('count', models.IntegerField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='BuildRequest',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('step', models.IntegerField(blank=True, null=True)),
                ('automatical_fabric_count',
                 models.IntegerField(blank=True, null=True)),
                ('simple_fabric_count',
                 models.IntegerField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='EGPRequest',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('egp_count', models.IntegerField(blank=True, null=True)),
                ('egp_price', models.IntegerField(blank=True, null=True)),
                ('bank_response',
                 models.CharField(blank=True, max_length=2000, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='ESMRequest',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('esm_count', models.IntegerField(blank=True, null=True)),
                ('esm_price', models.IntegerField(blank=True, null=True)),
                ('bank_response',
                 models.CharField(blank=True, max_length=2000, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Game',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('room_name', models.CharField(max_length=100)),
                ('players_count', models.IntegerField()),
                ('step', models.IntegerField(blank=True, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Loan',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('loan_amount', models.IntegerField()),
                ('loan_date', models.DateField()),
            ],
        ),
        migrations.CreateModel(
            name='PlayerGameInfo',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('capital', models.IntegerField(blank=True, null=True)),
                ('auto_fabric_count', models.IntegerField(blank=True,
                                                          null=True)),
                ('simple_fabric_count',
                 models.IntegerField(blank=True, null=True)),
                ('esm', models.IntegerField(blank=True, null=True)),
                ('egp', models.IntegerField(blank=True, null=True)),
                ('egp_request_id',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='game.egprequest')),
                ('esm_request_id',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='game.esmrequest')),
                ('loan_id',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='game.loan')),
                ('player_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
                ('room_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='game.game')),
            ],
        ),
        migrations.CreateModel(
            name='BuildRequestList',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('player_info_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='build_player_id',
                                   to='game.playergameinfo')),
                ('request_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='game.automatizationrequest')),
            ],
        ),
        migrations.CreateModel(
            name='AutomatizationRequestList',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('player_info_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='auto_player_id',
                                   to='game.playergameinfo')),
                ('request_id',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='game.buildrequest')),
            ],
        ),
        migrations.AddConstraint(
            model_name='playergameinfo',
            constraint=models.UniqueConstraint(fields=('player_id', 'room_id'),
                                               name='unique_game_info'),
        ),
        migrations.AddConstraint(
            model_name='buildrequestlist',
            constraint=models.UniqueConstraint(fields=('player_info_id',
                                                       'request_id'),
                                               name='unique_in_build_request'),
        ),
        migrations.AddConstraint(
            model_name='automatizationrequestlist',
            constraint=models.UniqueConstraint(fields=('player_info_id',
                                                       'request_id'),
                                               name='unique_in_auto_request'),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('cm', '0065_auto_20210220_0902'),
    ]

    operations = [
        migrations.RenameField(
            model_name='joblog',
            old_name='action_id',
            new_name='old_action_id',
        ),
        migrations.AlterField(
            model_name='joblog',
            name='old_action_id',
            field=models.PositiveIntegerField(default=0),
        ),
        migrations.RenameField(
            model_name='joblog',
            old_name='sub_action_id',
            new_name='old_sub_action_id',
        ),
        migrations.RenameField(
            model_name='joblog',
            old_name='task_id',
            new_name='old_task_id',
        ),
        migrations.RenameField(
            model_name='tasklog',
            old_name='action_id',
            new_name='old_action_id',
        ),
        migrations.AlterField(
            model_name='tasklog',
            name='old_action_id',
            field=models.PositiveIntegerField(default=0),
        ),
        migrations.AddField(
            model_name='joblog',
            name='action',
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='cm.action',
            ),
        ),
        migrations.AddField(
            model_name='joblog',
            name='sub_action',
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='cm.subaction',
            ),
        ),
        migrations.AddField(
            model_name='joblog',
            name='task',
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='cm.tasklog',
            ),
        ),
        migrations.AddField(
            model_name='tasklog',
            name='action',
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.CASCADE,
                to='cm.action'),
        ),
        migrations.RemoveConstraint(
            model_name='groupchecklog',
            name='unique_group_job',
        ),
        migrations.RenameField(
            model_name='checklog',
            old_name='job_id',
            new_name='old_job_id',
        ),
        migrations.RenameField(
            model_name='groupchecklog',
            old_name='job_id',
            new_name='old_job_id',
        ),
        migrations.AddField(
            model_name='checklog',
            name='job',
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='cm.joblog',
            ),
        ),
        migrations.AddField(
            model_name='groupchecklog',
            name='job',
            field=models.ForeignKey(
                default=None,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='cm.joblog',
            ),
        ),
        migrations.AddConstraint(
            model_name='groupchecklog',
            constraint=models.UniqueConstraint(fields=('job', 'title'),
                                               name='unique_group_job'),
        ),
        migrations.RunPython(fix_tasklog),
        migrations.RunPython(fix_joblog),
        migrations.RunPython(fix_checklog),
        migrations.RunPython(fix_grouplog),
        migrations.RemoveField(
            model_name='checklog',
            name='old_job_id',
        ),
        migrations.RemoveField(
            model_name='groupchecklog',
            name='old_job_id',
        ),
        migrations.RemoveField(
            model_name='joblog',
            name='old_action_id',
        ),
        migrations.RemoveField(
            model_name='joblog',
            name='old_sub_action_id',
        ),
        migrations.RemoveField(
            model_name='joblog',
            name='old_task_id',
        ),
        migrations.RemoveField(
            model_name='tasklog',
            name='old_action_id',
        ),
    ]
Exemple #16
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['paper', 'location'],
                                 name='Paper and Location')
     ]
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['user', 'genre'],
                                 name='Unique favourite genre')
     ]
Exemple #18
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="Feature",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("internal_name", models.CharField(max_length=128,
                                                   unique=True)),
                ("priority", models.SmallIntegerField(default=200)),
                ("is_public", models.BooleanField(default=False)),
                ("icon_code", models.TextField(default="<i>*</i>")),
                ("label_is_html", models.BooleanField(default=False)),
            ],
            options={
                "verbose_name": "feature",
                "verbose_name_plural": "features",
                "db_table": "builds_feature",
            },
        ),
        migrations.CreateModel(
            name="Platform",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("name", models.CharField(max_length=64, unique=True)),
                ("icon_code", models.TextField(default="<i>*</i>")),
            ],
            options={
                "verbose_name": "platform",
                "verbose_name_plural": "platforms",
            },
        ),
        migrations.CreateModel(
            name="TranslatedFeature",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "lang_code",
                    models.SlugField(
                        choices=[("en", "English"), ("ru", "Russian")],
                        default="en",
                        max_length=16,
                    ),
                ),
                ("label_code", models.CharField(max_length=2048)),
                (
                    "base",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="translations",
                        to="builds.feature",
                    ),
                ),
            ],
            options={
                "verbose_name": "feature translation",
                "verbose_name_plural": "feature translations",
                "db_table": "builds_feature_trans",
                "abstract": False,
            },
            bases=(celestia.bleach_models.BleachMixin, models.Model),
        ),
        migrations.CreateModel(
            name="Build",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                (
                    "update_datetime",
                    models.DateTimeField(auto_now=True,
                                         verbose_name="date and time updated"),
                ),
                (
                    "create_datetime",
                    models.DateTimeField(
                        default=django.utils.timezone.now,
                        verbose_name="date and time created",
                    ),
                ),
                ("file", models.FileField(default="test.txt", upload_to="")),
                ("has_doomseeker", models.BooleanField(default=False)),
                ("size", models.PositiveBigIntegerField(default=0)),
                ("crc32", models.CharField(blank=True, max_length=8)),
                ("checksum_a", models.CharField(blank=True, max_length=144)),
                ("version", models.CharField(max_length=255)),
                (
                    "file_datetime",
                    models.DateTimeField(
                        default=datetime.datetime(1999,
                                                  12,
                                                  31,
                                                  21,
                                                  0,
                                                  tzinfo=utc),
                        verbose_name="date and time file was changed",
                    ),
                ),
                (
                    "platform",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="builds.platform",
                    ),
                ),
            ],
            options={
                "verbose_name": "build",
                "verbose_name_plural": "builds",
            },
        ),
        migrations.AddConstraint(
            model_name="translatedfeature",
            constraint=models.UniqueConstraint(
                fields=("base", "lang_code"),
                name="builds_translatedfeature_unique_for_lang",
            ),
        ),
        migrations.AddConstraint(
            model_name="build",
            constraint=models.UniqueConstraint(
                fields=("platform", "version", "has_doomseeker"),
                name="builds_build_unique_for_pfm_opt_and_ver",
            ),
        ),
    ]
Exemple #19
0
class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        ('analysis', '0004_auto_20191007_1135'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='analysisfunction',
            name='automatic',
        ),
        migrations.AlterField(
            model_name='analysisfunction',
            name='pyfunc',
            field=models.CharField(max_length=256, default='test', null=True),
            preserve_default=False,
        ),
        migrations.RemoveField(
            model_name='analysisfunction',
            name='pyfunc',
        ),
        migrations.AddField(
            model_name='analysisfunction',
            name='card_view_flavor',
            field=models.CharField(choices=[
                ('simple',
                 'Simple display of the results as raw data structure'),
                ('plot', 'Display results in a plot with multiple datasets'),
                ('power spectrum',
                 'Display results in a plot suitable for power spectrum'),
                ('contact mechanics',
                 'Display suitable for contact mechanics including special widgets'
                 ), ('rms table', 'Display a table with RMS values.')
            ],
                                   default='simple',
                                   max_length=50),
        ),
        migrations.CreateModel(
            name='AnalysisFunctionImplementation',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('code_ref',
                 models.CharField(
                     help_text=
                     "name of Python function in 'topobank.analysis.functions' module",
                     max_length=256)),
                ('function',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='implementations',
                                   to='analysis.AnalysisFunction')),
                ('subject_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.ContentType')),
            ],
        ),
        migrations.AddConstraint(
            model_name='analysisfunctionimplementation',
            constraint=models.UniqueConstraint(fields=('function',
                                                       'subject_type'),
                                               name='distinct_implementation'),
        ),
        migrations.AddField(
            model_name='analysis',
            name='subject_id',
            field=models.PositiveIntegerField(default=0),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='analysis',
            name='subject_type',
            field=models.ForeignKey(
                default=ContentType.objects.get_for_model(Topography).id,
                on_delete=django.db.models.deletion.CASCADE,
                to='contenttypes.ContentType'),
            preserve_default=False,
        ),
        migrations.RunPython(
            code=replace_topography_by_subject,
            reverse_code=reverse_replace_topography_by_subject),
        #migrations.AlterField(
        #  model_name='analysis',
        #  name='topography',
        #  field=models.ForeignKey('manager.Topography', on_delete=models.CASCADE, default=2),
        #  preserve_default=False,
        #),
        #migrations.RemoveField(
        #    model_name='analysis',
        #    name='topography'
        #),
    ]
Exemple #20
0
 class Meta:
     constraints = [
         models.UniqueConstraint(
             fields=['cart', 'food'], name='cart item constraint')
     ]
class Migration(migrations.Migration):

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

    operations = [
        migrations.CreateModel(
            name='Game',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('game_map',
                 models.CharField(choices=[('Tharsis', 'Tharsis'),
                                           ('Elysium', 'Elysium'),
                                           ('Hellas', 'Hellas')],
                                  default='Tharsis',
                                  max_length=16)),
                ('draft_variant', models.BooleanField(default=True)),
                ('prelude', models.BooleanField(default=False)),
                ('venus_next', models.BooleanField(default=False)),
                ('colonies', models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name='Player',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('nickname', models.CharField(max_length=32, unique=True)),
                ('motto',
                 models.CharField(blank=True, max_length=128, null=True)),
                ('user',
                 models.OneToOneField(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='PlayerScore',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('corporation',
                 models.CharField(choices=[
                     ('Aphrodite', 'Aphrodite'), ('Aridor', 'Aridor'),
                     ('Arklight', 'Arklight'), ('Celestic', 'Celestic'),
                     ('Cheung Shing Mars', 'Cheung Shing Mars'),
                     ('Credicor', 'Credicor'), ('Ecoline', 'Ecoline'),
                     ('Helion', 'Helion'),
                     ('Interplanetary Cinematics',
                      'Interplanetary Cinematics'), ('Inventrix', 'Inventrix'),
                     ('Manutech', 'Manutech'),
                     ('Mining Guild', 'Mining Guild'),
                     ('Morning Star Inc.', 'Morning Star Inc.'),
                     ('Phobolog', 'Phobolog'), ('Point Luna', 'Point Luna'),
                     ('Polyphemos', 'Polyphemos'), ('Poseidon', 'Poseidon'),
                     ('Robinson Industries', 'Robinson Industries'),
                     ('Saturn Systems', 'Saturn Systems'),
                     ('Storm Craft Incorporated', 'Storm Craft Incorporated'),
                     ('Terractor', 'Terractor'),
                     ('Tharsis Republic', 'Tharsis Republic'),
                     ('Thorgate', 'Thorgate'),
                     ('United Nations Mars Initiative',
                      'United Nations Mars Initiative'),
                     ('Valley Trust', 'Valley Trust'), ('Viron', 'Viron'),
                     ('Vitor', 'Vitor')
                 ],
                                  max_length=64)),
                ('terraform_rating',
                 models.PositiveSmallIntegerField(default=20)),
                ('milestones', models.PositiveSmallIntegerField(default=0)),
                ('awards', models.PositiveSmallIntegerField(default=0)),
                ('greeneries', models.PositiveSmallIntegerField(default=0)),
                ('cities', models.PositiveSmallIntegerField(default=0)),
                ('event_cards', models.SmallIntegerField(default=0)),
                ('automated_cards', models.SmallIntegerField(default=0)),
                ('active_cards', models.SmallIntegerField(default=0)),
                ('resources', models.SmallIntegerField(default=0)),
                ('game',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='scores',
                                   to='mars_api.game')),
                ('player',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='scores',
                     to='mars_api.player')),
            ],
            options={
                'default_related_name': 'scores',
            },
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Hellas', 'Elysium', 'Tharsis'} maps are allowed."
            ),
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.UniqueConstraint(
                fields=('player', 'game'),
                name='one_score_per_player_per_game'),
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.UniqueConstraint(
                fields=('corporation', 'game'),
                name='only_unique_corporations_per_game'),
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.CheckConstraint(
                check=models.Q(
                    corporation__in={
                        'Celestic', 'Thorgate', 'Cheung Shing Mars',
                        'Poseidon', 'Storm Craft Incorporated', 'Helion',
                        'Inventrix', 'Aridor', 'Valley Trust', 'Viron',
                        'Robinson Industries',
                        'United Nations Mars Initiative', 'Vitor',
                        'Point Luna', 'Arklight', 'Aphrodite', 'Polyphemos',
                        'Phobolog', 'Manutech', 'Terractor', 'Ecoline',
                        'Tharsis Republic', 'Morning Star Inc.',
                        'Mining Guild', 'Saturn Systems',
                        'Interplanetary Cinematics', 'Credicor'
                    }),
                name='Only defined corporations are allowed.'),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Hellas', 'Elysium', 'Tharsis'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Elysium', 'Hellas', 'Tharsis'} maps are allowed."
            ),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Elysium', 'Hellas', 'Tharsis'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Hellas', 'Elysium', 'Tharsis'} maps are allowed."
            ),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Hellas', 'Elysium', 'Tharsis'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Elysium', 'Hellas', 'Tharsis'} maps are allowed."
            ),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Elysium', 'Hellas', 'Tharsis'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Hellas', 'Elysium', 'Tharsis'} maps are allowed."
            ),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Hellas', 'Elysium', 'Tharsis'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Elysium', 'Hellas', 'Tharsis'} maps are allowed."
            ),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Elysium', 'Hellas', 'Tharsis'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name="Only {'Elysium', 'Tharsis', 'Hellas'} maps are allowed."
            ),
        ),
        migrations.RemoveConstraint(
            model_name='game',
            name="Only {'Elysium', 'Tharsis', 'Hellas'} maps are allowed.",
        ),
        migrations.AddConstraint(
            model_name='game',
            constraint=models.CheckConstraint(
                check=models.Q(game_map__in={'Hellas', 'Tharsis', 'Elysium'}),
                name='Only defined maps are allowed.'),
        ),
        migrations.RemoveConstraint(
            model_name='playerscore',
            name='Only defined corporations are allowed.',
        ),
        migrations.AddField(
            model_name='game',
            name='number_of_generations',
            field=models.PositiveSmallIntegerField(default=10),
        ),
        migrations.AlterField(
            model_name='playerscore',
            name='corporation',
            field=models.CharField(choices=[
                ('Aphrodite', 'Aphrodite'),
                ('Aridor', 'Aridor'), ('Arklight', 'Arklight'),
                ('Celestic', 'Celestic'),
                ('Cheung Shing Mars', 'Cheung Shing Mars'),
                ('Credicor', 'Credicor'), ('Ecoline', 'Ecoline'),
                ('Helion', 'Helion'),
                ('Interplanetary Cinematics', 'Interplanetary Cinematics'),
                ('Inventrix', 'Inventrix'), ('N/A', 'N/A'),
                ('Manutech', 'Manutech'), ('Mining Guild', 'Mining Guild'),
                ('Morning Star Inc.', 'Morning Star Inc.'),
                ('Phobolog', 'Phobolog'), ('Point Luna', 'Point Luna'),
                ('Polyphemos', 'Polyphemos'), ('Poseidon', 'Poseidon'),
                ('Robinson Industries', 'Robinson Industries'),
                ('Saturn Systems', 'Saturn Systems'),
                ('Storm Craft Incorporated', 'Storm Craft Incorporated'),
                ('Teractor', 'Teractor'),
                ('Tharsis Republic', 'Tharsis Republic'),
                ('Thorgate', 'Thorgate'),
                ('United Nations Mars Initiative',
                 'United Nations Mars Initiative'),
                ('Valley Trust', 'Valley Trust'), ('Viron', 'Viron'),
                ('Vitor', 'Vitor')
            ],
                                   max_length=64),
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.CheckConstraint(
                check=models.Q(
                    corporation__in={
                        'Celestic', 'Thorgate', 'Poseidon',
                        'Cheung Shing Mars', 'Storm Craft Incorporated',
                        'Helion', 'Inventrix', 'Aridor', 'Valley Trust',
                        'Viron', 'Robinson Industries', 'Teractor',
                        'United Nations Mars Initiative', 'Vitor',
                        'Point Luna', 'Arklight', 'Aphrodite', 'Phobolog',
                        'Polyphemos', 'Manutech', 'N/A', 'Ecoline',
                        'Tharsis Republic', 'Morning Star Inc.',
                        'Mining Guild', 'Saturn Systems',
                        'Interplanetary Cinematics', 'Credicor'
                    }),
                name='Only defined corporations are allowed.'),
        ),
        migrations.RemoveConstraint(
            model_name='playerscore',
            name='only_unique_corporations_per_game',
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.UniqueConstraint(
                condition=models.Q(_negated=True,
                                   corporation__startswith='N/A'),
                fields=('corporation', 'game'),
                name='only_unique_corporations_per_game'),
        ),
        migrations.RemoveConstraint(
            model_name='playerscore',
            name='only_unique_corporations_per_game',
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.UniqueConstraint(
                fields=('corporation', 'game'),
                name='only_unique_corporations_per_game'),
        ),
        migrations.RemoveConstraint(
            model_name='playerscore',
            name='only_unique_corporations_per_game',
        ),
        migrations.AddConstraint(
            model_name='playerscore',
            constraint=models.UniqueConstraint(
                condition=models.Q(_negated=True,
                                   corporation__startswith='N/A'),
                fields=('corporation', 'game'),
                name='only_unique_corporations_per_game'),
        ),
    ]
Exemple #22
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=200, verbose_name='Название')),
                ('slug', models.SlugField(max_length=30, unique=True)),
            ],
            options={
                'verbose_name': 'Категория',
                'verbose_name_plural': 'Категории',
                'ordering': ('id', ),
            },
        ),
        migrations.CreateModel(
            name='Genre',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=200,
                                  unique=True,
                                  verbose_name='Название')),
                ('slug', models.SlugField(max_length=30, unique=True)),
            ],
            options={
                'verbose_name': 'Жанр',
                'verbose_name_plural': 'Жанры',
                'ordering': ('id', ),
            },
        ),
        migrations.CreateModel(
            name='Title',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(max_length=200, verbose_name='Название')),
                ('year',
                 models.SmallIntegerField(
                     validators=[api.validators.validate_year],
                     verbose_name='Год выхода ("-" для года до н.э.)')),
                ('rating',
                 models.PositiveSmallIntegerField(
                     blank=True,
                     null=True,
                     validators=[
                         django.core.validators.MinValueValidator(1),
                         django.core.validators.MaxValueValidator(10)
                     ],
                     verbose_name='Рейтинг')),
                ('description',
                 models.TextField(blank=True,
                                  null=True,
                                  verbose_name='Описание')),
                ('category',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='titles',
                     to='api.Category',
                     verbose_name='Категория')),
                ('genre',
                 models.ManyToManyField(blank=True,
                                        related_name='titles',
                                        to='api.Genre',
                                        verbose_name='Жанр')),
            ],
            options={
                'verbose_name': 'Произведение',
                'verbose_name_plural': 'Произведения',
                'ordering': ('id', ),
            },
        ),
        migrations.CreateModel(
            name='Review',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.TextField(max_length=5000,
                                          verbose_name='Текст')),
                ('score',
                 models.PositiveSmallIntegerField(
                     default=1,
                     validators=[
                         django.core.validators.MaxValueValidator(10),
                         django.core.validators.MinValueValidator(1)
                     ],
                     verbose_name='Оценка')),
                ('pub_date',
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name='Дата публикации')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reviews',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Автор')),
                ('title',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reviews',
                                   to='api.Title',
                                   verbose_name='Произведение')),
            ],
            options={
                'verbose_name': 'Отзыв',
                'verbose_name_plural': 'Отзывы',
                'ordering': ('-pub_date', ),
            },
        ),
        migrations.CreateModel(
            name='Comment',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('text', models.TextField(max_length=500,
                                          verbose_name='Текст')),
                ('pub_date',
                 models.DateTimeField(auto_now_add=True,
                                      db_index=True,
                                      verbose_name='Дата публикации')),
                ('author',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='Автор')),
                ('review',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='comments',
                                   to='api.Review',
                                   verbose_name='Отзыв')),
            ],
            options={
                'verbose_name': 'Комментарий',
                'verbose_name_plural': 'Комментарии',
                'ordering': ('-pub_date', ),
            },
        ),
        migrations.AddConstraint(
            model_name='review',
            constraint=models.UniqueConstraint(fields=('author', 'title'),
                                               name='unique review'),
        ),
    ]
Exemple #23
0
 class Meta:
     constraints = [
         models.UniqueConstraint(
             fields=['user', 'recipe'], name='unique_favorite')
     ]
Exemple #24
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Link',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('cost', models.FloatField(verbose_name='Cost')),
            ],
            options={
                'verbose_name': 'Link',
                'verbose_name_plural': 'Links',
            },
        ),
        migrations.CreateModel(
            name='Map',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('title',
                 models.CharField(blank=True,
                                  max_length=255,
                                  null=True,
                                  verbose_name='Map Title')),
                ('user',
                 models.ForeignKey(editable=False,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   related_name='maps',
                                   related_query_name='map',
                                   to=settings.AUTH_USER_MODEL,
                                   verbose_name='User')),
            ],
            options={
                'verbose_name': 'Map',
                'verbose_name_plural': 'Maps',
            },
        ),
        migrations.CreateModel(
            name='Node',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('pos_h',
                 models.IntegerField(verbose_name='Horizontal Position')),
                ('pos_v',
                 models.IntegerField(verbose_name='Vertical Position')),
                ('direct_successors',
                 models.ManyToManyField(
                     related_name='direct_predecessors',
                     related_query_name='direct_predecessor',
                     through='rail_network.Link',
                     to='rail_network.Node',
                     verbose_name='Nodes linked to')),
                ('map',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='nodes',
                                   related_query_name='node',
                                   to='rail_network.Map',
                                   verbose_name='Map')),
            ],
            options={
                'verbose_name': 'Node',
                'verbose_name_plural': 'Nodes',
            },
        ),
        migrations.AddField(
            model_name='link',
            name='head',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='incoming_links',
                related_query_name='incoming_link',
                to='rail_network.Node',
                verbose_name='"to"-Node'),
        ),
        migrations.AddField(
            model_name='link',
            name='tail',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='outgoing_links',
                related_query_name='outgoing_link',
                to='rail_network.Node',
                verbose_name='"from"-Node'),
        ),
        migrations.CreateModel(
            name='City',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('name',
                 models.CharField(blank=True,
                                  max_length=255,
                                  null=True,
                                  verbose_name='City name')),
                ('node',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='rail_network.Node',
                     verbose_name='Node')),
            ],
            options={
                'verbose_name': 'City',
                'verbose_name_plural': 'Cities',
            },
        ),
        migrations.AddConstraint(
            model_name='node',
            constraint=models.UniqueConstraint(fields=('map', 'pos_h',
                                                       'pos_v'),
                                               name='exclusive_position'),
        ),
    ]
Exemple #25
0
 class Meta:
     constraints = [
         models.UniqueConstraint(
             fields=['title', 'dimension'], name='unique_ingredient')
     ]
class Migration(migrations.Migration):
    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name='Company',
            fields=[
                ('created',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='created')),
                ('modified',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modified')),
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('name', models.TextField()),
                ('location', models.TextField()),
                ('slogan', models.TextField(blank=True, default='')),
                ('logo_url', models.URLField(blank=True, default='')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CompanyUserPermissions',
            fields=[
                ('created',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='created')),
                ('modified',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modified')),
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('is_admin', models.BooleanField(default=False)),
                ('can_edit', models.BooleanField(default=False)),
                ('can_create_jobs', models.BooleanField(default=False)),
                ('company',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='company_user_permissions',
                                   to='api.company')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('created',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='created')),
                ('modified',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modified')),
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('name', models.TextField()),
                ('email', models.EmailField(max_length=254)),
                ('auth0_id', models.TextField()),
                ('linkedin_id', models.TextField()),
                ('github_username', models.TextField(blank=True, default='')),
                ('is_developer', models.BooleanField(default=False)),
                ('location', models.TextField()),
                ('avatar_url', models.URLField(blank=True, default='')),
                ('languages',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(), size=None)),
                ('skills',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(), size=None)),
                ('companies',
                 models.ManyToManyField(through='api.CompanyUserPermissions',
                                        to='api.Company')),
            ],
        ),
        migrations.CreateModel(
            name='Job',
            fields=[
                ('created',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='created')),
                ('modified',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modified')),
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('title', models.TextField()),
                ('location', models.TextField()),
                ('description', models.TextField()),
                ('skills',
                 django.contrib.postgres.fields.ArrayField(
                     base_field=models.TextField(), size=None)),
                ('company',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='jobs',
                                   to='api.company')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='companyuserpermissions',
            name='user',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                related_name='company_user_permissions',
                to='api.user'),
        ),
        migrations.AddField(
            model_name='company',
            name='users',
            field=models.ManyToManyField(through='api.CompanyUserPermissions',
                                         to='api.User'),
        ),
        migrations.AddConstraint(
            model_name='user',
            constraint=models.CheckConstraint(
                check=models.Q(
                    ('is_developer', False),
                    models.Q(('is_developer', True),
                             models.Q(_negated=True,
                                      github_username__exact='')),
                    _connector='OR'),
                name='required_developer_fields'),
        ),
        migrations.AddConstraint(
            model_name='user',
            constraint=models.UniqueConstraint(condition=models.Q(
                _negated=True, github_username__exact=''),
                                               fields=('github_username', ),
                                               name='unique_github_username'),
        ),
    ]
Exemple #27
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['user', 'author'],
                                 name='unique_followers'),
     ]
Exemple #28
0
 class Meta:
     constraints = (models.UniqueConstraint(
         fields=('primary', 'secondary'),
         name='db_exchange_rate_primary_secondary_unique'), )
     index_together = ('primary', 'secondary')
Exemple #29
0
 class Meta:
     constraints = [
         models.UniqueConstraint(fields=['first_name', 'last_name', 'age'],
                                 name='unique person')
     ]
Exemple #30
0
 class Meta:
     verbose_name_plural = "Matches"
     constraints = [
         models.UniqueConstraint(fields=['profile1', 'profile2'],
                                 name='unique_matches')
     ]