示例#1
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('adserver', '0054_add_payout_status_dates'),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalPublisherPayout',
            fields=[
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('id',
                 models.UUIDField(db_index=True,
                                  default=uuid.uuid4,
                                  editable=False)),
                ('amount',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=8,
                                     verbose_name='Amount')),
                ('date', models.DateTimeField(verbose_name='Payout date')),
                ('method',
                 models.CharField(blank=True,
                                  choices=[
                                      ('stripe',
                                       'Stripe (Bank transfer, debit card)'),
                                      ('paypal', 'PayPal'),
                                      ('opencollective', 'Open Collective'),
                                      ('other', 'Other')
                                  ],
                                  default=None,
                                  max_length=100,
                                  null=True)),
                ('note',
                 models.TextField(
                     blank=True,
                     help_text='A publisher-visible note about the payout',
                     null=True,
                     verbose_name='Note')),
                ('attachment',
                 models.TextField(
                     blank=True,
                     help_text=
                     'A publisher-visible attachment such as a receipt',
                     max_length=255,
                     null=True,
                     verbose_name='Attachment')),
                ('start_date',
                 models.DateField(help_text='First day of paid period',
                                  null=True,
                                  verbose_name='Start Date')),
                ('end_date',
                 models.DateField(help_text='Last day of paid period',
                                  null=True,
                                  verbose_name='End Date')),
                ('status',
                 models.CharField(choices=[('pending', 'Pending'),
                                           ('hold', 'On hold'),
                                           ('emailed', 'Email sent'),
                                           ('paid', 'Payment sent')],
                                  default='pending',
                                  help_text='Status of this payout',
                                  max_length=50)),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
                ('publisher',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='adserver.Publisher')),
            ],
            options={
                'verbose_name': 'historical publisher payout',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalPublisherGroup',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name',
                 models.CharField(help_text='Visible to advertisers',
                                  max_length=200,
                                  verbose_name='Name')),
                ('slug',
                 models.SlugField(max_length=200,
                                  verbose_name='Publisher group slug')),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical publisher group',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalPublisher',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Name')),
                ('slug',
                 models.SlugField(max_length=200,
                                  verbose_name='Publisher Slug')),
                ('revenue_share_percentage',
                 models.FloatField(
                     default=70.0,
                     help_text=
                     'Percentage of advertising revenue shared with this publisher',
                     validators=[
                         django.core.validators.MinValueValidator(0),
                         django.core.validators.MaxValueValidator(100)
                     ])),
                ('default_keywords',
                 models.CharField(
                     blank=True,
                     default='',
                     help_text=
                     'A CSV of default keywords for this property. Used for targeting.',
                     max_length=250,
                     verbose_name='Default keywords')),
                ('unauthed_ad_decisions',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'Whether this publisher allows unauthenticated ad decision API requests (eg. JSONP)'
                 )),
                ('allow_paid_campaigns',
                 models.BooleanField(default=False,
                                     verbose_name='Allow paid campaigns')),
                ('allow_affiliate_campaigns',
                 models.BooleanField(
                     default=False, verbose_name='Allow affiliate campaigns')),
                ('allow_community_campaigns',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'These are unpaid campaigns that support non-profit projects in our community. Shown only when no paid ads are available',
                     verbose_name='Allow community campaigns')),
                ('allow_house_campaigns',
                 models.BooleanField(
                     default=True,
                     help_text=
                     'These are ads for EthicalAds itself. Shown only when no paid ads are available.',
                     verbose_name='Allow house campaigns')),
                ('payout_method',
                 models.CharField(blank=True,
                                  choices=[
                                      ('stripe',
                                       'Stripe (Bank transfer, debit card)'),
                                      ('paypal', 'PayPal'),
                                      ('opencollective', 'Open Collective'),
                                      ('other', 'Other')
                                  ],
                                  default=None,
                                  max_length=100,
                                  null=True)),
                ('stripe_connected_account_id',
                 models.CharField(blank=True,
                                  default=None,
                                  max_length=200,
                                  null=True,
                                  verbose_name='Stripe connected account ID')),
                ('open_collective_name',
                 models.CharField(blank=True,
                                  default=None,
                                  max_length=200,
                                  null=True,
                                  verbose_name='Open Collective name')),
                ('paypal_email',
                 models.EmailField(blank=True,
                                   default=None,
                                   max_length=254,
                                   null=True,
                                   verbose_name='PayPal email address')),
                ('record_views',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Record each ad view from this publisher to the database')
                 ),
                ('record_placements',
                 models.BooleanField(
                     default=False,
                     help_text='Record placement impressions for this publisher'
                 )),
                ('render_pixel',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Render ethical-pixel in ad templates. This is needed for users not using the ad client.'
                 )),
                ('sampled_ctr',
                 models.FloatField(
                     default=0.0,
                     help_text=
                     'A periodically calculated CTR from a sample of ads on this publisher.'
                 )),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical publisher',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalFlight',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Name')),
                ('slug',
                 models.SlugField(max_length=200, verbose_name='Flight Slug')),
                ('start_date',
                 models.DateField(
                     db_index=True,
                     default=datetime.date.today,
                     help_text='This ad will not be shown before this date',
                     verbose_name='Start Date')),
                ('end_date',
                 models.DateField(
                     default=adserver.models.default_flight_end_date,
                     help_text=
                     'The target end date for the ad (it may go after this date)',
                     verbose_name='End Date')),
                ('live', models.BooleanField(default=False,
                                             verbose_name='Live')),
                ('priority_multiplier',
                 models.IntegerField(
                     default=1,
                     help_text=
                     "Multiplies chance of showing this flight's ads [1,1000000]",
                     validators=[
                         django.core.validators.MinValueValidator(1),
                         django.core.validators.MaxValueValidator(1000000)
                     ],
                     verbose_name='Priority Multiplier')),
                ('cpc',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=5,
                                     verbose_name='Cost Per Click')),
                ('sold_clicks',
                 models.PositiveIntegerField(default=0,
                                             verbose_name='Sold Clicks')),
                ('cpm',
                 models.DecimalField(decimal_places=2,
                                     default=0,
                                     max_digits=5,
                                     verbose_name='Cost Per 1k Impressions')),
                ('sold_impressions',
                 models.PositiveIntegerField(default=0,
                                             verbose_name='Sold Impressions')),
                ('targeting_parameters',
                 jsonfield.fields.JSONField(
                     blank=True,
                     null=True,
                     validators=[
                         adserver.validators.TargetingParametersValidator()
                     ],
                     verbose_name='Targeting parameters')),
                ('total_views',
                 models.PositiveIntegerField(
                     default=0,
                     help_text='Views across all ads in this flight')),
                ('total_clicks',
                 models.PositiveIntegerField(
                     default=0,
                     help_text='Clicks across all ads in this flight')),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('campaign',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='adserver.Campaign')),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical flight',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalCampaign',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Name')),
                ('slug',
                 models.SlugField(max_length=200,
                                  verbose_name='Campaign Slug')),
                ('campaign_type',
                 models.CharField(
                     choices=[('paid', 'Paid'), ('affiliate', 'Affiliate'),
                              ('community',
                               'Community'), ('house', 'House')],
                     default='paid',
                     help_text=
                     'Most campaigns are paid but ad server admins can configure other lower priority campaign types.',
                     max_length=20,
                     verbose_name='Campaign Type')),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('advertiser',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     help_text='The advertiser for this campaign.',
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='adserver.Advertiser')),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical campaign',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalAdvertiser',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Name')),
                ('slug',
                 models.SlugField(max_length=200,
                                  verbose_name='Advertiser Slug')),
                ('stripe_customer_id',
                 models.CharField(blank=True,
                                  default=None,
                                  max_length=200,
                                  null=True,
                                  verbose_name='Stripe Customer ID')),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical advertiser',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalAdvertisement',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Name')),
                ('slug', models.SlugField(max_length=200,
                                          verbose_name='Slug')),
                ('text',
                 models.TextField(
                     blank=True,
                     help_text=
                     'For most ad types, the text should be less than 100 characters.',
                     verbose_name='Text')),
                ('headline',
                 models.CharField(
                     blank=True,
                     help_text=
                     'An optional headline at the beginning of the ad usually displayed in bold',
                     max_length=200,
                     null=True)),
                ('content',
                 models.TextField(
                     blank=True,
                     help_text=
                     'For most ad types, the combined length of the headline, body, and call to action should be less than 100 characters.',
                     null=True)),
                ('cta',
                 models.CharField(
                     blank=True,
                     help_text=
                     'An optional call to action displayed at the end of the ad usually in bold',
                     max_length=200,
                     null=True,
                     verbose_name='Call to action')),
                ('link',
                 models.URLField(
                     help_text=
                     "URL of your landing page. This may contain UTM parameters so you know the traffic came from us. The publisher will be added in the 'ea-publisher' query parameter.",
                     max_length=255,
                     verbose_name='Link URL')),
                ('image',
                 models.TextField(blank=True,
                                  help_text='Sized according to the ad type',
                                  max_length=255,
                                  null=True,
                                  verbose_name='Image')),
                ('live', models.BooleanField(default=False,
                                             verbose_name='Live')),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('ad_type',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     default=None,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='adserver.AdType')),
                ('flight',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='adserver.Flight')),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical advertisement',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalAdType',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('created',
                 django_extensions.db.fields.CreationDateTimeField(
                     auto_now_add=True, verbose_name='created')),
                ('modified',
                 django_extensions.db.fields.ModificationDateTimeField(
                     auto_now=True, verbose_name='modified')),
                ('name', models.CharField(max_length=200,
                                          verbose_name='Name')),
                ('slug', models.SlugField(max_length=200,
                                          verbose_name='Slug')),
                ('has_image',
                 models.BooleanField(default=True, verbose_name='Has image?')),
                ('image_width',
                 models.PositiveIntegerField(blank=True, null=True)),
                ('image_height',
                 models.PositiveIntegerField(blank=True, null=True)),
                ('has_text',
                 models.BooleanField(default=True, verbose_name='Has text?')),
                ('max_text_length',
                 models.PositiveIntegerField(
                     blank=True,
                     help_text='Max length does not include HTML tags',
                     null=True)),
                ('allowed_html_tags',
                 models.CharField(
                     blank=True,
                     default='a b strong i em code',
                     help_text='Space separated list of allowed HTML tag names',
                     max_length=255,
                     verbose_name='Allowed HTML tags')),
                ('default_enabled',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Whether this ad type should default to checked when advertisers are creating ads'
                 )),
                ('template',
                 models.TextField(
                     blank=True,
                     help_text=
                     'Override the template for rendering this ad type',
                     null=True,
                     verbose_name='Ad template')),
                ('description',
                 models.CharField(
                     blank=True,
                     default='',
                     help_text=
                     'A short description of the ad type to guide advertisers.',
                     max_length=255)),
                ('order', models.PositiveSmallIntegerField(default=0)),
                ('deprecated',
                 models.BooleanField(
                     default=False,
                     help_text=
                     'Users cannot select deprecated ad types unless an ad is already that type.'
                 )),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical ad type',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [("caluma_form", "0019_remove_answer_value_document")]

    operations = [
        migrations.CreateModel(
            name="HistoricalAnswer",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                (
                    "value",
                    django.contrib.postgres.fields.jsonb.JSONField(
                        blank=True, null=True
                    ),
                ),
                ("meta", django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
                ("date", models.DateField(blank=True, null=True)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Document",
                    ),
                ),
                (
                    "file",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.File",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical answer",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalAnswerDocument",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                (
                    "sort",
                    models.PositiveIntegerField(
                        db_index=True, default=0, editable=False
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "answer",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Answer",
                    ),
                ),
                (
                    "document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Document",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical answer document",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalDocument",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                (
                    "family",
                    models.UUIDField(
                        db_index=True, help_text="Family id which document belongs too."
                    ),
                ),
                ("meta", django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical document",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalFile",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                ("name", models.CharField(max_length=255)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical file",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalForm",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                ("slug", models.SlugField()),
                ("name", localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "description",
                    localized_fields.fields.field.LocalizedField(
                        blank=True, null=True, required=[]
                    ),
                ),
                ("meta", django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
                ("is_published", models.BooleanField(default=False)),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "source",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Reference this form has been copied from",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical form",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalFormQuestion",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                (
                    "id",
                    models.UUIDField(db_index=True, default=uuid.uuid4, editable=False),
                ),
                (
                    "sort",
                    models.PositiveIntegerField(
                        db_index=True, default=0, editable=False
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical form question",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalOption",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                ("slug", models.SlugField()),
                ("label", localized_fields.fields.field.LocalizedField(required=[])),
                ("meta", django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "source",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Reference this option has been copied from",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Option",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical option",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalQuestion",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                ("slug", models.SlugField()),
                ("label", localized_fields.fields.field.LocalizedField(required=[])),
                (
                    "type",
                    models.CharField(
                        choices=[
                            ("multiple_choice", "multiple_choice"),
                            ("integer", "integer"),
                            ("float", "float"),
                            ("date", "date"),
                            ("choice", "choice"),
                            ("textarea", "textarea"),
                            ("text", "text"),
                            ("table", "table"),
                            ("form", "form"),
                            ("file", "file"),
                            ("dynamic_choice", "dynamic_choice"),
                            ("dynamic_multiple_choice", "dynamic_multiple_choice"),
                            ("static", "static"),
                        ],
                        max_length=23,
                    ),
                ),
                ("is_required", models.TextField(default="false")),
                ("is_hidden", models.TextField(default="false")),
                ("is_archived", models.BooleanField(default=False)),
                (
                    "placeholder",
                    localized_fields.fields.field.LocalizedField(
                        blank=True, null=True, required=[]
                    ),
                ),
                (
                    "info_text",
                    localized_fields.fields.field.LocalizedField(
                        blank=True, null=True, required=[]
                    ),
                ),
                (
                    "static_content",
                    localized_fields.fields.text_field.LocalizedTextField(
                        blank=True, null=True, required=[]
                    ),
                ),
                (
                    "configuration",
                    django.contrib.postgres.fields.jsonb.JSONField(default=dict),
                ),
                ("meta", django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
                (
                    "data_source",
                    models.CharField(blank=True, max_length=255, null=True),
                ),
                (
                    "format_validators",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.CharField(max_length=255),
                        blank=True,
                        default=list,
                        size=None,
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "row_form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Form that represents rows of a TableQuestion",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
                (
                    "source",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Reference this question has been copied from",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
                (
                    "sub_form",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        help_text="Form referenced in a FormQuestion",
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Form",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical question",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalQuestionOption",
            fields=[
                ("created_at", models.DateTimeField(blank=True, editable=False)),
                ("modified_at", models.DateTimeField(blank=True, editable=False)),
                (
                    "created_by_user",
                    models.CharField(blank=True, max_length=150, null=True),
                ),
                (
                    "created_by_group",
                    models.CharField(
                        blank=True, db_index=True, max_length=150, null=True
                    ),
                ),
                ("history_user_id", models.CharField(max_length=150, null=True)),
                ("id", models.CharField(db_index=True, max_length=255)),
                (
                    "sort",
                    models.PositiveIntegerField(
                        db_index=True, default=0, editable=False
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "option",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Option",
                    ),
                ),
                (
                    "question",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="caluma_form.Question",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical question option",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('catalogue',
         '0039_historicalproduct_historicalproductattributevalue'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('basket', '0011_add_email_basket_attribute_type'),
        ('sites', '0002_alter_domain_unique'),
        ('partner', '0014_historicalstockrecord'),
        ('order', '0017_order_partner'),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalLine',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('partner_name',
                 models.CharField(blank=True,
                                  max_length=128,
                                  verbose_name='Partner name')),
                ('partner_sku',
                 models.CharField(max_length=128, verbose_name='Partner SKU')),
                ('partner_line_reference',
                 models.CharField(
                     blank=True,
                     help_text=
                     'This is the item number that the partner uses within their system',
                     max_length=128,
                     verbose_name='Partner reference')),
                ('partner_line_notes',
                 models.TextField(blank=True, verbose_name='Partner Notes')),
                ('title', models.CharField(max_length=255,
                                           verbose_name='Title')),
                ('upc',
                 models.CharField(blank=True,
                                  max_length=128,
                                  null=True,
                                  verbose_name='UPC')),
                ('quantity',
                 models.PositiveIntegerField(default=1,
                                             verbose_name='Quantity')),
                ('line_price_incl_tax',
                 models.DecimalField(decimal_places=2,
                                     max_digits=12,
                                     verbose_name='Price (inc. tax)')),
                ('line_price_excl_tax',
                 models.DecimalField(decimal_places=2,
                                     max_digits=12,
                                     verbose_name='Price (excl. tax)')),
                ('line_price_before_discounts_incl_tax',
                 models.DecimalField(
                     decimal_places=2,
                     max_digits=12,
                     verbose_name='Price before discounts (inc. tax)')),
                ('line_price_before_discounts_excl_tax',
                 models.DecimalField(
                     decimal_places=2,
                     max_digits=12,
                     verbose_name='Price before discounts (excl. tax)')),
                ('unit_cost_price',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     max_digits=12,
                                     null=True,
                                     verbose_name='Unit Cost Price')),
                ('unit_price_incl_tax',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     max_digits=12,
                                     null=True,
                                     verbose_name='Unit Price (inc. tax)')),
                ('unit_price_excl_tax',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     max_digits=12,
                                     null=True,
                                     verbose_name='Unit Price (excl. tax)')),
                ('unit_retail_price',
                 models.DecimalField(blank=True,
                                     decimal_places=2,
                                     max_digits=12,
                                     null=True,
                                     verbose_name='Unit Retail Price')),
                ('status',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='Status')),
                ('est_dispatch_date',
                 models.DateField(blank=True,
                                  null=True,
                                  verbose_name='Estimated Dispatch Date')),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
                ('order',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='order.Order',
                     verbose_name='Order')),
                ('partner',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='partner.Partner',
                     verbose_name='Partner')),
                ('product',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='catalogue.Product',
                     verbose_name='Product')),
                ('stockrecord',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='partner.StockRecord',
                     verbose_name='Stock record')),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
                'verbose_name': 'historical Order Line',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalOrder',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('number',
                 models.CharField(db_index=True,
                                  max_length=128,
                                  verbose_name='Order number')),
                ('currency',
                 models.CharField(
                     default=oscar.core.utils.get_default_currency,
                     max_length=12,
                     verbose_name='Currency')),
                ('total_incl_tax',
                 models.DecimalField(decimal_places=2,
                                     max_digits=12,
                                     verbose_name='Order total (inc. tax)')),
                ('total_excl_tax',
                 models.DecimalField(decimal_places=2,
                                     max_digits=12,
                                     verbose_name='Order total (excl. tax)')),
                ('shipping_incl_tax',
                 models.DecimalField(
                     decimal_places=2,
                     default=0,
                     max_digits=12,
                     verbose_name='Shipping charge (inc. tax)')),
                ('shipping_excl_tax',
                 models.DecimalField(
                     decimal_places=2,
                     default=0,
                     max_digits=12,
                     verbose_name='Shipping charge (excl. tax)')),
                ('shipping_method',
                 models.CharField(blank=True,
                                  max_length=128,
                                  verbose_name='Shipping method')),
                ('shipping_code',
                 models.CharField(blank=True, default=b'', max_length=128)),
                ('status',
                 models.CharField(blank=True,
                                  max_length=100,
                                  verbose_name='Status')),
                ('guest_email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='Guest email address')),
                ('date_placed', models.DateTimeField(db_index=True)),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('basket',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='basket.Basket',
                     verbose_name='Basket')),
                ('billing_address',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='order.BillingAddress',
                     verbose_name='Billing Address')),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
                ('partner',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='partner.Partner')),
                ('shipping_address',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='order.ShippingAddress',
                     verbose_name='Shipping Address')),
                ('site',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='sites.Site',
                     verbose_name='Site')),
                ('user',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL,
                     verbose_name='User')),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
                'verbose_name': 'historical Order',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('courses', '0010_migrate_partner_data_to_courses'),
        ('catalogue', '0038_coupon_enterprise_id_attribute'),
    ]

    operations = [
        migrations.CreateModel(
            name='HistoricalProduct',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('structure', models.CharField(choices=[(b'standalone', 'Stand-alone product'), (b'parent', 'Parent product'), (b'child', 'Child product')], default=b'standalone', max_length=10, verbose_name='Product structure')),
                ('upc', oscar.models.fields.NullCharField(db_index=True, help_text='Universal Product Code (UPC) is an identifier for a product which is not specific to a particular  supplier. Eg an ISBN for a book.', max_length=64, verbose_name='UPC')),
                ('title', models.CharField(blank=True, max_length=255, verbose_name='Title')),
                ('slug', models.SlugField(max_length=255, verbose_name='Slug')),
                ('description', models.TextField(blank=True, verbose_name='Description')),
                ('rating', models.FloatField(editable=False, null=True, verbose_name='Rating')),
                ('date_created', models.DateTimeField(blank=True, editable=False, verbose_name='Date created')),
                ('date_updated', models.DateTimeField(blank=True, db_index=True, editable=False, verbose_name='Date updated')),
                ('is_discountable', models.BooleanField(default=True, help_text='This flag indicates if this product can be used in an offer or not', verbose_name='Is discountable?')),
                ('expires', models.DateTimeField(blank=True, help_text='Last date/time on which this product can be purchased.', null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('course', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='courses.Course')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('parent', models.ForeignKey(blank=True, db_constraint=False, help_text="Only choose a parent product if you're creating a child product.  For example if this is a size 4 of a particular t-shirt.  Leave blank if this is a stand-alone product (i.e. there is only one version of this product).", null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='catalogue.Product', verbose_name='Parent product')),
                ('product_class', models.ForeignKey(blank=True, db_constraint=False, help_text='Choose what type of product this is', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='catalogue.ProductClass', verbose_name='Product type')),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
                'verbose_name': 'historical Product',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalProductAttributeValue',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('value_text', models.TextField(blank=True, null=True, verbose_name='Text')),
                ('value_integer', models.IntegerField(blank=True, null=True, verbose_name='Integer')),
                ('value_boolean', models.NullBooleanField(verbose_name='Boolean')),
                ('value_float', models.FloatField(blank=True, null=True, verbose_name='Float')),
                ('value_richtext', models.TextField(blank=True, null=True, verbose_name='Richtext')),
                ('value_date', models.DateField(blank=True, null=True, verbose_name='Date')),
                ('value_datetime', models.DateTimeField(blank=True, null=True, verbose_name='DateTime')),
                ('value_file', models.TextField(blank=True, max_length=255, null=True)),
                ('value_image', models.TextField(blank=True, max_length=255, null=True)),
                ('entity_object_id', models.PositiveIntegerField(blank=True, editable=False, null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('attribute', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='catalogue.ProductAttribute', verbose_name='Attribute')),
                ('entity_content_type', models.ForeignKey(blank=True, db_constraint=False, editable=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='contenttypes.ContentType')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('product', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='catalogue.Product', verbose_name='Product')),
                ('value_option', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='catalogue.AttributeOption', verbose_name='Value option')),
            ],
            options={
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
                'verbose_name': 'historical Product attribute value',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
示例#5
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='Grant',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('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')),
                ('title',
                 models.CharField(
                     max_length=255,
                     validators=[
                         django.core.validators.MinLengthValidator(3),
                         django.core.validators.MaxLengthValidator(255)
                     ])),
                ('grant_number',
                 models.CharField(
                     max_length=255,
                     validators=[
                         django.core.validators.MinLengthValidator(3),
                         django.core.validators.MaxLengthValidator(255)
                     ],
                     verbose_name='Grant Number from funding agency')),
                ('role',
                 models.CharField(choices=[
                     ('PI', 'Principal Investigator (PI)'),
                     ('CoPI', 'Co-Principal Investigator (CoPI)'),
                     ('SP', 'Senior Personnel (SP)')
                 ],
                                  max_length=10)),
                ('grant_pi_full_name',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='Grant PI Full Name')),
                ('other_funding_agency',
                 models.CharField(blank=True, max_length=255)),
                ('other_award_number',
                 models.CharField(blank=True, max_length=255)),
                ('grant_start',
                 models.DateField(verbose_name='Grant Start Date')),
                ('grant_end', models.DateField(verbose_name='Grant End Date')),
                ('percent_credit',
                 models.FloatField(validators=[
                     django.core.validators.MaxValueValidator(100)
                 ])),
                ('direct_funding', models.FloatField()),
                ('total_amount_awarded', models.FloatField()),
            ],
            options={
                'verbose_name_plural': 'Grants',
            },
        ),
        migrations.CreateModel(
            name='GrantFundingAgency',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=255)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='GrantStatusChoice',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=64)),
            ],
            options={
                'ordering': ('name', ),
            },
        ),
        migrations.CreateModel(
            name='HistoricalGrant',
            fields=[
                ('id',
                 models.IntegerField(auto_created=True,
                                     blank=True,
                                     db_index=True,
                                     verbose_name='ID')),
                ('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')),
                ('title',
                 models.CharField(
                     max_length=255,
                     validators=[
                         django.core.validators.MinLengthValidator(3),
                         django.core.validators.MaxLengthValidator(255)
                     ])),
                ('grant_number',
                 models.CharField(
                     max_length=255,
                     validators=[
                         django.core.validators.MinLengthValidator(3),
                         django.core.validators.MaxLengthValidator(255)
                     ],
                     verbose_name='Grant Number from funding agency')),
                ('role',
                 models.CharField(choices=[
                     ('PI', 'Principal Investigator (PI)'),
                     ('CoPI', 'Co-Principal Investigator (CoPI)'),
                     ('SP', 'Senior Personnel (SP)')
                 ],
                                  max_length=10)),
                ('grant_pi_full_name',
                 models.CharField(blank=True,
                                  max_length=255,
                                  verbose_name='Grant PI Full Name')),
                ('other_funding_agency',
                 models.CharField(blank=True, max_length=255)),
                ('other_award_number',
                 models.CharField(blank=True, max_length=255)),
                ('grant_start',
                 models.DateField(verbose_name='Grant Start Date')),
                ('grant_end', models.DateField(verbose_name='Grant End Date')),
                ('percent_credit',
                 models.FloatField(validators=[
                     django.core.validators.MaxValueValidator(100)
                 ])),
                ('direct_funding', models.FloatField()),
                ('total_amount_awarded', models.FloatField()),
                ('history_id',
                 models.AutoField(primary_key=True, serialize=False)),
                ('history_change_reason',
                 models.CharField(max_length=100, null=True)),
                ('history_date', models.DateTimeField()),
                ('history_type',
                 models.CharField(choices=[('+', 'Created'), ('~', 'Changed'),
                                           ('-', 'Deleted')],
                                  max_length=1)),
                ('funding_agency',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='grant.GrantFundingAgency')),
                ('history_user',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='+',
                     to=settings.AUTH_USER_MODEL)),
                ('project',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='project.Project')),
                ('status',
                 models.ForeignKey(
                     blank=True,
                     db_constraint=False,
                     null=True,
                     on_delete=django.db.models.deletion.DO_NOTHING,
                     related_name='+',
                     to='grant.GrantStatusChoice')),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical grant',
                'ordering': ('-history_date', '-history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name='grant',
            name='funding_agency',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='grant.GrantFundingAgency'),
        ),
        migrations.AddField(
            model_name='grant',
            name='project',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='project.Project'),
        ),
        migrations.AddField(
            model_name='grant',
            name='status',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='grant.GrantStatusChoice'),
        ),
    ]
示例#6
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("datasets", "0021_historicalcitycouncilattendancelist"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalCityCouncilRevenue",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Criado em"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Atualizado em"),
                ),
                ("crawled_at",
                 models.DateTimeField(verbose_name="Coletado em")),
                ("crawled_from", models.URLField(verbose_name="Fonte")),
                (
                    "notes",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Anotações"),
                ),
                (
                    "external_code",
                    models.CharField(db_index=True,
                                     max_length=10,
                                     verbose_name="Código externo"),
                ),
                (
                    "budget_unit",
                    models.PositiveIntegerField(
                        default=101, verbose_name="Unidade gestora"),
                ),
                (
                    "published_at",
                    models.DateField(db_index=True,
                                     null=True,
                                     verbose_name="Publicado em"),
                ),
                (
                    "registered_at",
                    models.DateField(db_index=True,
                                     null=True,
                                     verbose_name="Registrado em"),
                ),
                (
                    "revenue_type",
                    models.CharField(
                        choices=[
                            ("orcamentaria", "Orçamentária"),
                            ("nao_orcamentaria", "Não-orçamentária"),
                            ("transferencia", "Transferência"),
                        ],
                        db_index=True,
                        max_length=20,
                        verbose_name="Tipo da receita",
                    ),
                ),
                (
                    "modality",
                    models.CharField(blank=True,
                                     max_length=60,
                                     null=True,
                                     verbose_name="Modalidade"),
                ),
                ("description", models.TextField(verbose_name="Descrição")),
                (
                    "value",
                    models.DecimalField(decimal_places=2,
                                        max_digits=10,
                                        verbose_name="Valor"),
                ),
                (
                    "resource",
                    models.CharField(
                        blank=True,
                        default="prefeitura",
                        max_length=200,
                        null=True,
                        verbose_name="Fonte",
                    ),
                ),
                (
                    "legal_status",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=200,
                        null=True,
                        verbose_name="Natureza",
                    ),
                ),
                (
                    "destination",
                    models.CharField(blank=True,
                                     max_length=200,
                                     null=True,
                                     verbose_name="Destinação"),
                ),
                (
                    "excluded",
                    models.BooleanField(default=False,
                                        verbose_name="Excluído?"),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Câmara de Vereadores - Receita",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalCityCouncilExpense",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Criado em"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Atualizado em"),
                ),
                ("crawled_at",
                 models.DateTimeField(verbose_name="Coletado em")),
                ("crawled_from", models.URLField(verbose_name="Fonte")),
                (
                    "notes",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Anotações"),
                ),
                (
                    "published_at",
                    models.DateField(
                        blank=True,
                        db_index=True,
                        null=True,
                        verbose_name="Publicado em",
                    ),
                ),
                (
                    "phase",
                    models.CharField(
                        choices=[
                            ("empenho", "Empenho"),
                            ("liquidacao", "Liquidação"),
                            ("pagamento", "Pagamento"),
                        ],
                        db_index=True,
                        max_length=20,
                        verbose_name="Fase",
                    ),
                ),
                (
                    "phase_code",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=20,
                        null=True,
                        verbose_name="Código da fase",
                    ),
                ),
                (
                    "company_or_person",
                    models.TextField(
                        blank=True,
                        db_index=True,
                        null=True,
                        verbose_name="Empresa ou pessoa",
                    ),
                ),
                (
                    "value",
                    models.DecimalField(decimal_places=2,
                                        max_digits=10,
                                        verbose_name="Valor"),
                ),
                (
                    "number",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Número",
                    ),
                ),
                (
                    "document",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="CNPJ ou CPF",
                    ),
                ),
                ("date", models.DateField(db_index=True, verbose_name="Data")),
                (
                    "process_number",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Número do processo",
                    ),
                ),
                (
                    "summary",
                    models.TextField(blank=True,
                                     db_index=True,
                                     null=True,
                                     verbose_name="Descrição"),
                ),
                (
                    "legal_status",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=200,
                        null=True,
                        verbose_name="Natureza",
                    ),
                ),
                (
                    "function",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Função",
                    ),
                ),
                (
                    "subfunction",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Subfunção",
                    ),
                ),
                (
                    "resource",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=200,
                        null=True,
                        verbose_name="Fonte",
                    ),
                ),
                (
                    "subgroup",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=100,
                        null=True,
                        verbose_name="Subgrupos",
                    ),
                ),
                (
                    "group",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=100,
                        null=True,
                        verbose_name="Grupo",
                    ),
                ),
                (
                    "budget_unit",
                    models.PositiveIntegerField(
                        default=101, verbose_name="Unidade orçamentária"),
                ),
                (
                    "modality",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("convenio", "Convênio"),
                            ("tomada_de_precos", "Tomada de Preço"),
                            ("pregao", "Pregão"),
                            ("inexigibilidade", "Inexigibilidade"),
                            ("convite", "Convite"),
                            ("concorrencia", "Concorrência"),
                            ("dispensa", "Dispensa"),
                            ("isento", "Isento"),
                        ],
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Modalidade",
                    ),
                ),
                (
                    "excluded",
                    models.BooleanField(default=False,
                                        verbose_name="Excluído?"),
                ),
                (
                    "external_file_code",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Código do arquivo (externo)",
                    ),
                ),
                (
                    "external_file_line",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="Linha do arquivo (externo)",
                    ),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Câmara de Vereadores - Despesa",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalCityCouncilContract",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Criado em"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Atualizado em"),
                ),
                ("crawled_at",
                 models.DateTimeField(verbose_name="Coletado em")),
                ("crawled_from", models.URLField(verbose_name="Fonte")),
                (
                    "notes",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Anotações"),
                ),
                (
                    "external_code",
                    models.PositiveIntegerField(db_index=True,
                                                verbose_name="Código externo"),
                ),
                (
                    "description",
                    models.TextField(blank=True,
                                     db_index=True,
                                     null=True,
                                     verbose_name="Descrição"),
                ),
                (
                    "details",
                    models.TextField(
                        blank=True,
                        db_index=True,
                        null=True,
                        verbose_name="Objeto do contrato",
                    ),
                ),
                (
                    "company_or_person_document",
                    models.CharField(
                        blank=True,
                        db_index=True,
                        max_length=50,
                        null=True,
                        verbose_name="CNPJ ou CPF",
                    ),
                ),
                (
                    "company_or_person",
                    models.TextField(
                        blank=True,
                        db_index=True,
                        null=True,
                        verbose_name="Empresa ou pessoa",
                    ),
                ),
                (
                    "value",
                    models.DecimalField(decimal_places=2,
                                        max_digits=10,
                                        verbose_name="Valor"),
                ),
                (
                    "start_date",
                    models.DateField(db_index=True,
                                     verbose_name="Data de início"),
                ),
                (
                    "end_date",
                    models.DateField(db_index=True, verbose_name="Data final"),
                ),
                (
                    "excluded",
                    models.BooleanField(default=False,
                                        verbose_name="Excluído?"),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Câmara de Vereadores - Contrato",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalCityCouncilBid",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Criado em"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Atualizado em"),
                ),
                ("crawled_at",
                 models.DateTimeField(verbose_name="Coletado em")),
                ("crawled_from", models.URLField(verbose_name="Fonte")),
                (
                    "notes",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Anotações"),
                ),
                (
                    "external_code",
                    models.CharField(db_index=True,
                                     max_length=10,
                                     verbose_name="Código externo"),
                ),
                (
                    "modality",
                    models.CharField(
                        blank=True,
                        choices=[
                            ("tomada_de_precos", "Tomada de Preço"),
                            ("pregao_presencial", "Pregão Presencial"),
                            ("pregao_eletronico", "Pregão Eletrônico"),
                            ("leilao", "Leilão"),
                            ("inexigibilidade", "Inexigibilidade"),
                            ("dispensada", "Dispensada"),
                            ("convite", "Convite"),
                            ("concurso", "Concurso"),
                            ("concorrencia", "Concorrência"),
                            ("chamada_publica", "Chamada Pública"),
                        ],
                        db_index=True,
                        max_length=60,
                        null=True,
                        verbose_name="Modalidade",
                    ),
                ),
                (
                    "code",
                    models.CharField(db_index=True,
                                     max_length=15,
                                     verbose_name="Código da licitação"),
                ),
                (
                    "code_type",
                    models.CharField(
                        db_index=True,
                        max_length=15,
                        verbose_name="Código do tipo da licitação",
                    ),
                ),
                (
                    "description",
                    models.TextField(db_index=True,
                                     verbose_name="Descrição (objeto)"),
                ),
                (
                    "session_at",
                    models.DateTimeField(db_index=True,
                                         null=True,
                                         verbose_name="Sessão Data / Horário"),
                ),
                (
                    "excluded",
                    models.BooleanField(default=False,
                                        verbose_name="Excluído?"),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Câmara de Vereadores - Licitação",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
示例#7
0
class Migration(migrations.Migration):

    dependencies = [
        ("sites", "0002_alter_domain_unique"),
        ("inte_lists", "0006_auto_20200812_0317"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("inte_subject", "0035_auto_20200821_0009"),
    ]

    operations = [
        migrations.CreateModel(
            name="ClinicalReview",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text="System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True, max_length=10)),
                ("device_modified", models.CharField(blank=True, max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text="If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.datetime_not_before_study_start,
                            edc_model.models.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "crf_status",
                    models.CharField(
                        choices=[
                            ("INCOMPLETE", "Incomplete (some data pending)"),
                            ("COMPLETE", "Complete"),
                        ],
                        default="INCOMPLETE",
                        help_text="If some data is still pending, flag this CRF as incomplete",
                        max_length=25,
                        verbose_name="CRF status",
                    ),
                ),
                (
                    "crf_status_comments",
                    models.TextField(
                        blank=True,
                        help_text="for example, why some data is still pending",
                        null=True,
                        verbose_name="Any comments related to status of this CRF",
                    ),
                ),
                (
                    "hiv_tested",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if previously diagnosed. `Since last seen` includes today.",
                        max_length=15,
                        verbose_name="Since last seen, was the patient tested for HIV infection?",
                    ),
                ),
                (
                    "hiv_test_date",
                    models.DateField(
                        blank=True, null=True, verbose_name="Date test requested"
                    ),
                ),
                (
                    "hiv_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "hiv_dx",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name="As of today, was the patient <u>newly</u> diagnosed with HIV infection?",
                    ),
                ),
                (
                    "hypertension_tested",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if previously diagnosed. `Since last seen` includes today.",
                        max_length=15,
                        verbose_name="Since last seen, was the patient tested for hypertension?",
                    ),
                ),
                (
                    "hypertension_test_date",
                    models.DateField(
                        blank=True, null=True, verbose_name="Date test requested"
                    ),
                ),
                (
                    "hypertension_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "hypertension_dx",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name="As of today, was the patient <u>newly</u> diagnosed with hypertension?",
                    ),
                ),
                (
                    "diabetes_tested",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if previously diagnosed. `Since last seen` includes today.",
                        max_length=15,
                        verbose_name="Since last seen, was the patient tested for diabetes?",
                    ),
                ),
                (
                    "diabetes_test_date",
                    models.DateField(
                        blank=True, null=True, verbose_name="Date test requested"
                    ),
                ),
                (
                    "diabetes_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "diabetes_dx",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name="As of today, was the patient <u>newly</u> diagnosed with diabetes?",
                    ),
                ),
                (
                    "test_date",
                    models.DateField(
                        blank=True,
                        editable=False,
                        help_text="question_retired",
                        null=True,
                        verbose_name="Date test requested",
                    ),
                ),
                (
                    "reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "diabetes_reason",
                    models.ManyToManyField(
                        blank=True,
                        related_name="diabetes_tested_reason",
                        to="inte_lists.ReasonsForTesting",
                        verbose_name="Why was the patient tested for diabetes?",
                    ),
                ),
                (
                    "hiv_reason",
                    models.ManyToManyField(
                        blank=True,
                        related_name="hiv_tested_reason",
                        to="inte_lists.ReasonsForTesting",
                        verbose_name="Why was the patient tested for HIV infection?",
                    ),
                ),
                (
                    "hypertension_reason",
                    models.ManyToManyField(
                        blank=True,
                        related_name="hypertension_tested_reason",
                        to="inte_lists.ReasonsForTesting",
                        verbose_name="Why was the patient tested for hypertension?",
                    ),
                ),
                (
                    "reason",
                    models.ManyToManyField(
                        blank=True,
                        editable=False,
                        help_text="question_retired",
                        to="inte_lists.ReasonsForTesting",
                        verbose_name="Why was the patient tested?",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="inte_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "Clinical Review",
                "verbose_name_plural": "Clinical Reviews",
                "ordering": ("-modified", "-created"),
                "get_latest_by": "modified",
                "abstract": False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site", django.contrib.sites.managers.CurrentSiteManager()),
                ("objects", edc_visit_tracking.managers.CrfModelManager()),
            ],
        ),
        migrations.CreateModel(
            name="HistoricalClinicalReview",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text="System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True, max_length=10)),
                ("device_modified", models.CharField(blank=True, max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text="If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.datetime_not_before_study_start,
                            edc_model.models.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "crf_status",
                    models.CharField(
                        choices=[
                            ("INCOMPLETE", "Incomplete (some data pending)"),
                            ("COMPLETE", "Complete"),
                        ],
                        default="INCOMPLETE",
                        help_text="If some data is still pending, flag this CRF as incomplete",
                        max_length=25,
                        verbose_name="CRF status",
                    ),
                ),
                (
                    "crf_status_comments",
                    models.TextField(
                        blank=True,
                        help_text="for example, why some data is still pending",
                        null=True,
                        verbose_name="Any comments related to status of this CRF",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "hiv_tested",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if previously diagnosed. `Since last seen` includes today.",
                        max_length=15,
                        verbose_name="Since last seen, was the patient tested for HIV infection?",
                    ),
                ),
                (
                    "hiv_test_date",
                    models.DateField(
                        blank=True, null=True, verbose_name="Date test requested"
                    ),
                ),
                (
                    "hiv_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "hiv_dx",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name="As of today, was the patient <u>newly</u> diagnosed with HIV infection?",
                    ),
                ),
                (
                    "hypertension_tested",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if previously diagnosed. `Since last seen` includes today.",
                        max_length=15,
                        verbose_name="Since last seen, was the patient tested for hypertension?",
                    ),
                ),
                (
                    "hypertension_test_date",
                    models.DateField(
                        blank=True, null=True, verbose_name="Date test requested"
                    ),
                ),
                (
                    "hypertension_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "hypertension_dx",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name="As of today, was the patient <u>newly</u> diagnosed with hypertension?",
                    ),
                ),
                (
                    "diabetes_tested",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if previously diagnosed. `Since last seen` includes today.",
                        max_length=15,
                        verbose_name="Since last seen, was the patient tested for diabetes?",
                    ),
                ),
                (
                    "diabetes_test_date",
                    models.DateField(
                        blank=True, null=True, verbose_name="Date test requested"
                    ),
                ),
                (
                    "diabetes_reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "diabetes_dx",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=15,
                        verbose_name="As of today, was the patient <u>newly</u> diagnosed with diabetes?",
                    ),
                ),
                (
                    "test_date",
                    models.DateField(
                        blank=True,
                        editable=False,
                        help_text="question_retired",
                        null=True,
                        verbose_name="Date test requested",
                    ),
                ),
                (
                    "reason_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="inte_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Clinical Review",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalMedications",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text="System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True, max_length=10)),
                ("device_modified", models.CharField(blank=True, max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text="If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.datetime_not_before_study_start,
                            edc_model.models.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "crf_status",
                    models.CharField(
                        choices=[
                            ("INCOMPLETE", "Incomplete (some data pending)"),
                            ("COMPLETE", "Complete"),
                        ],
                        default="INCOMPLETE",
                        help_text="If some data is still pending, flag this CRF as incomplete",
                        max_length=25,
                        verbose_name="CRF status",
                    ),
                ),
                (
                    "crf_status_comments",
                    models.TextField(
                        blank=True,
                        help_text="for example, why some data is still pending",
                        null=True,
                        verbose_name="Any comments related to status of this CRF",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "refill_hiv",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if subject has not been prescribed medication for HIV infection.",
                        max_length=25,
                        verbose_name="Is the patient filling / refilling HIV medications?",
                    ),
                ),
                (
                    "refill_diabetes",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if subject has not been prescribed medication for Diabetes.",
                        max_length=25,
                        verbose_name="Is the patient filling / refilling Diabetes medications?",
                    ),
                ),
                (
                    "refill_hypertension",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if subject has not been prescribed medication for Hypertension.",
                        max_length=25,
                        verbose_name="Is the patient filling / refilling Hypertension medications?",
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason", models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"), ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="inte_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Medications",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="Medications",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text="System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True, max_length=10)),
                ("device_modified", models.CharField(blank=True, max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text="If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.datetime_not_before_study_start,
                            edc_model.models.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "crf_status",
                    models.CharField(
                        choices=[
                            ("INCOMPLETE", "Incomplete (some data pending)"),
                            ("COMPLETE", "Complete"),
                        ],
                        default="INCOMPLETE",
                        help_text="If some data is still pending, flag this CRF as incomplete",
                        max_length=25,
                        verbose_name="CRF status",
                    ),
                ),
                (
                    "crf_status_comments",
                    models.TextField(
                        blank=True,
                        help_text="for example, why some data is still pending",
                        null=True,
                        verbose_name="Any comments related to status of this CRF",
                    ),
                ),
                (
                    "refill_hiv",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if subject has not been prescribed medication for HIV infection.",
                        max_length=25,
                        verbose_name="Is the patient filling / refilling HIV medications?",
                    ),
                ),
                (
                    "refill_diabetes",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if subject has not been prescribed medication for Diabetes.",
                        max_length=25,
                        verbose_name="Is the patient filling / refilling Diabetes medications?",
                    ),
                ),
                (
                    "refill_hypertension",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        help_text="Select `not applicable` if subject has not been prescribed medication for Hypertension.",
                        max_length=25,
                        verbose_name="Is the patient filling / refilling Hypertension medications?",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="inte_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "Medications",
                "verbose_name_plural": "Medications",
                "ordering": ("-modified", "-created"),
                "get_latest_by": "modified",
                "abstract": False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site", django.contrib.sites.managers.CurrentSiteManager()),
                ("objects", edc_visit_tracking.managers.CrfModelManager()),
            ],
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="diabetic",
            new_name="diabetes",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="diabetic_tested",
            new_name="diabetes_tested",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="diabetic_tested_ago",
            new_name="diabetes_tested_ago",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="diabetic_tested_date",
            new_name="diabetes_tested_date",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="hypertensive",
            new_name="hypertension",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="hypertensive_tested",
            new_name="hypertension_tested",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="hypertensive_tested_ago",
            new_name="hypertension_tested_ago",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="hypertensive_tested_date",
            new_name="hypertension_tested_date",
        ),
        migrations.RenameField(
            model_name="healtheconomics",
            old_name="diabetic_expenditure_month",
            new_name="diabetes_expenditure_month",
        ),
        migrations.RenameField(
            model_name="healtheconomics",
            old_name="diabetic_payee",
            new_name="diabetes_payee",
        ),
        migrations.RenameField(
            model_name="healtheconomics",
            old_name="hypertensive_expenditure_month",
            new_name="hypertension_expenditure_month",
        ),
        migrations.RenameField(
            model_name="healtheconomics",
            old_name="hypertensive_payee",
            new_name="hypertension_payee",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="diabetic",
            new_name="diabetes",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="diabetic_tested",
            new_name="diabetes_tested",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="diabetic_tested_ago",
            new_name="diabetes_tested_ago",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="diabetic_tested_date",
            new_name="diabetes_tested_date",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="hypertensive",
            new_name="hypertension",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="hypertensive_tested",
            new_name="hypertension_tested",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="hypertensive_tested_ago",
            new_name="hypertension_tested_ago",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="hypertensive_tested_date",
            new_name="hypertension_tested_date",
        ),
        migrations.RenameField(
            model_name="historicalhealtheconomics",
            old_name="diabetic_expenditure_month",
            new_name="diabetes_expenditure_month",
        ),
        migrations.RenameField(
            model_name="historicalhealtheconomics",
            old_name="diabetic_payee",
            new_name="diabetes_payee",
        ),
        migrations.RenameField(
            model_name="historicalhealtheconomics",
            old_name="hypertensive_expenditure_month",
            new_name="hypertension_expenditure_month",
        ),
        migrations.RenameField(
            model_name="historicalhealtheconomics",
            old_name="hypertensive_payee",
            new_name="hypertension_payee",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="diabetic_tested_estimated_datetime",
            new_name="diabetes_tested_estimated_datetime",
        ),
        migrations.RenameField(
            model_name="clinicalreviewbaseline",
            old_name="hypertensive_tested_estimated_datetime",
            new_name="hypertension_tested_estimated_datetime",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="diabetic_tested_estimated_datetime",
            new_name="diabetes_tested_estimated_datetime",
        ),
        migrations.RenameField(
            model_name="historicalclinicalreviewbaseline",
            old_name="hypertensive_tested_estimated_datetime",
            new_name="hypertension_tested_estimated_datetime",
        ),
        migrations.AddIndex(
            model_name="medications",
            index=models.Index(
                fields=["subject_visit", "site", "id"],
                name="inte_subjec_subject_8345ac_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="clinicalreview",
            index=models.Index(
                fields=["subject_visit", "site", "id"],
                name="inte_subjec_subject_059fb3_idx",
            ),
        ),
    ]
示例#8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("interactions", "0007_merge_20200326_1110"),
    ]

    operations = [
        migrations.CreateModel(
            name="WTOCommittee",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("name", models.CharField(max_length=255)),
            ],
            options={
                "ordering": ("name", ),
            },
        ),
        migrations.CreateModel(
            name="WTOCommitteeGroup",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("name", models.CharField(max_length=255)),
            ],
            options={
                "ordering": ("name", ),
            },
        ),
        migrations.CreateModel(
            name="WTOProfile",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("wto_has_been_notified", models.BooleanField()),
                ("wto_should_be_notified", models.NullBooleanField()),
                (
                    "committee_notification_link",
                    models.CharField(blank=True, max_length=255),
                ),
                (
                    "member_states",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.UUIDField(),
                        blank=True,
                        default=list,
                        null=True,
                        size=None,
                    ),
                ),
                ("raised_date", models.DateField(null=True)),
                ("case_number", models.CharField(blank=True, max_length=255)),
                (
                    "committee_notification_document",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="committee_notification_wto_profiles",
                        to="interactions.Document",
                    ),
                ),
                (
                    "committee_notified",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="committee_notified_wto_profiles",
                        to="wto.WTOCommittee",
                    ),
                ),
                (
                    "committee_raised_in",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="committee_raised_in_wto_profiles",
                        to="wto.WTOCommittee",
                    ),
                ),
                (
                    "meeting_minutes",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="meeting_minutes_wto_profiles",
                        to="interactions.Document",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="wtocommittee",
            name="wto_committee_group",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT,
                related_name="committees",
                to="wto.WTOCommitteeGroup",
            ),
        ),
        migrations.CreateModel(
            name="HistoricalWTOProfile",
            fields=[
                ("id", models.UUIDField(db_index=True, default=uuid.uuid4)),
                ("wto_has_been_notified", models.BooleanField()),
                ("wto_should_be_notified", models.NullBooleanField()),
                (
                    "committee_notification_link",
                    models.CharField(blank=True, max_length=255),
                ),
                (
                    "member_states",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.UUIDField(),
                        blank=True,
                        default=list,
                        null=True,
                        size=None,
                    ),
                ),
                ("raised_date", models.DateField(null=True)),
                ("case_number", models.CharField(blank=True, max_length=255)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "committee_notification_document",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="interactions.Document",
                    ),
                ),
                (
                    "committee_notified",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="wto.WTOCommittee",
                    ),
                ),
                (
                    "committee_raised_in",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="wto.WTOCommittee",
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "meeting_minutes",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="interactions.Document",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical wto profile",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("clubs", "0030_auto_20200818_1835"),
    ]

    operations = [
        migrations.AddField(
            model_name="club",
            name="ghost",
            field=models.BooleanField(default=False),
        ),
        migrations.CreateModel(
            name="HistoricalClub",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                ("approved", models.BooleanField(default=None, null=True)),
                ("approved_comment", models.TextField(blank=True, null=True)),
                ("approved_on", models.DateTimeField(blank=True, null=True)),
                ("fair", models.BooleanField(default=False)),
                ("code", models.SlugField(max_length=255)),
                ("active", models.BooleanField(default=False)),
                ("name", models.CharField(max_length=255)),
                ("subtitle", models.CharField(blank=True, max_length=255)),
                ("description", models.TextField(blank=True)),
                ("founded", models.DateField(blank=True, null=True)),
                (
                    "size",
                    models.IntegerField(choices=[(1, "1-20"), (2, "21-50"),
                                                 (3, "51-100"), (4, "101+")],
                                        default=1),
                ),
                ("email",
                 models.EmailField(blank=True, max_length=254, null=True)),
                ("facebook", models.URLField(blank=True, null=True)),
                ("website", models.URLField(blank=True, null=True)),
                ("twitter", models.URLField(blank=True, null=True)),
                ("instagram", models.URLField(blank=True, null=True)),
                ("linkedin", models.URLField(blank=True, null=True)),
                ("github", models.URLField(blank=True, null=True)),
                ("youtube", models.URLField(blank=True, null=True)),
                ("how_to_get_involved", models.TextField(blank=True)),
                (
                    "application_required",
                    models.IntegerField(
                        choices=[
                            (1, "No Application Required"),
                            (2, "Application Required For Some Positions"),
                            (3, "Application Required For All Positions"),
                        ],
                        default=3,
                    ),
                ),
                ("accepting_members", models.BooleanField(default=False)),
                ("listserv", models.CharField(blank=True, max_length=255)),
                ("image",
                 models.CharField(blank=True, max_length=100, null=True)),
                ("created_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("updated_at", models.DateTimeField(blank=True,
                                                    editable=False)),
                ("ghost", models.BooleanField(default=False)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(choices=[("+", "Created"),
                                              ("~", "Changed"),
                                              ("-", "Deleted")],
                                     max_length=1),
                ),
                (
                    "approved_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical club",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ("sites", "0002_alter_domain_unique"),
        ("meta_lists", "0010_auto_20200617_1738"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("meta_subject", "0050_auto_20200614_1934"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalSubjectVisitMissed",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text=
                        "If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.
                            datetime_not_before_study_start,
                            edc_model.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "survival_status",
                    models.CharField(
                        choices=[
                            ("alive", "Alive"),
                            ("dead", "Deceased"),
                            ("unknown", "Unknown"),
                        ],
                        max_length=25,
                        verbose_name="Survival status",
                    ),
                ),
                (
                    "contact_attempted",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        help_text="Not including pre-appointment reminders",
                        max_length=25,
                        verbose_name=
                        "Were any attempts made to contact the participant since the expected appointment date?",
                    ),
                ),
                (
                    "contact_attempts_count",
                    models.IntegerField(
                        blank=True,
                        help_text="Not including pre-appointment reminders",
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(1)
                        ],
                        verbose_name=
                        "Number of attempts made to contact participantsince the expected appointment date",
                    ),
                ),
                (
                    "contact_attempts_explained",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name=
                        "If contact not made and less than 3 attempts, please explain",
                    ),
                ),
                (
                    "contact_last_date",
                    models.DateField(
                        blank=True,
                        default=edc_utils.date.get_utcnow,
                        null=True,
                        validators=[
                            edc_model.validators.date.date_not_future,
                            edc_protocol.validators.
                            date_not_before_study_start,
                        ],
                        verbose_name="Date of last telephone contact/attempt",
                    ),
                ),
                (
                    "contact_made",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=25,
                        verbose_name=
                        "Was contact finally made with the participant?",
                    ),
                ),
                (
                    "missed_reasons_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "comment",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name="Please provide further details, if any",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="meta_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Missed Visit Report",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="SubjectVisitMissed",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text=
                        "If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.
                            datetime_not_before_study_start,
                            edc_model.validators.date.datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "survival_status",
                    models.CharField(
                        choices=[
                            ("alive", "Alive"),
                            ("dead", "Deceased"),
                            ("unknown", "Unknown"),
                        ],
                        max_length=25,
                        verbose_name="Survival status",
                    ),
                ),
                (
                    "contact_attempted",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        help_text="Not including pre-appointment reminders",
                        max_length=25,
                        verbose_name=
                        "Were any attempts made to contact the participant since the expected appointment date?",
                    ),
                ),
                (
                    "contact_attempts_count",
                    models.IntegerField(
                        blank=True,
                        help_text="Not including pre-appointment reminders",
                        null=True,
                        validators=[
                            django.core.validators.MinValueValidator(1)
                        ],
                        verbose_name=
                        "Number of attempts made to contact participantsince the expected appointment date",
                    ),
                ),
                (
                    "contact_attempts_explained",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name=
                        "If contact not made and less than 3 attempts, please explain",
                    ),
                ),
                (
                    "contact_last_date",
                    models.DateField(
                        blank=True,
                        default=edc_utils.date.get_utcnow,
                        null=True,
                        validators=[
                            edc_model.validators.date.date_not_future,
                            edc_protocol.validators.
                            date_not_before_study_start,
                        ],
                        verbose_name="Date of last telephone contact/attempt",
                    ),
                ),
                (
                    "contact_made",
                    models.CharField(
                        choices=[
                            ("Yes", "Yes"),
                            ("No", "No"),
                            ("N/A", "Not applicable"),
                        ],
                        default="N/A",
                        max_length=25,
                        verbose_name=
                        "Was contact finally made with the participant?",
                    ),
                ),
                (
                    "missed_reasons_other",
                    edc_model.models.fields.other_charfield.OtherCharField(
                        blank=True,
                        max_length=35,
                        null=True,
                        verbose_name="If other, please specify ...",
                    ),
                ),
                (
                    "comment",
                    models.TextField(
                        blank=True,
                        null=True,
                        verbose_name="Please provide further details, if any",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "missed_reasons",
                    models.ManyToManyField(
                        blank=True,
                        related_name="_subjectvisitmissed_missed_reasons_+",
                        to="meta_lists.SubjectVisitMissedReasons",
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="meta_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name":
                "Missed Visit Report",
                "verbose_name_plural":
                "Missed Visit Report",
                "ordering": ("-modified", "-created"),
                "get_latest_by":
                "modified",
                "abstract":
                False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site",
                 django.contrib.sites.managers.CurrentSiteManager()),
                ("objects", edc_visit_tracking.managers.CrfModelManager()),
            ],
        ),
        migrations.RemoveField(
            model_name="missedvisit",
            name="missed_reasons",
        ),
        migrations.RemoveField(
            model_name="missedvisit",
            name="site",
        ),
        migrations.RemoveField(
            model_name="missedvisit",
            name="subject_visit",
        ),
        migrations.DeleteModel(name="HistoricalMissedVisit", ),
        migrations.DeleteModel(name="MissedVisit", ),
        migrations.AddIndex(
            model_name="subjectvisitmissed",
            index=models.Index(
                fields=["subject_visit", "site", "id"],
                name="meta_subjec_subject_89b092_idx",
            ),
        ),
    ]
示例#11
0
class Migration(migrations.Migration):

    dependencies = [
        ("inte_lists", "0007_auto_20200910_1742"),
        ("sites", "0002_alter_domain_unique"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("inte_subject", "0053_auto_20200910_2201"),
    ]

    operations = [
        migrations.CreateModel(
            name="ComplicationsFollowup",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text=
                        "If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.
                            datetime_not_before_study_start,
                            edc_model.models.validators.date.
                            datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "crf_status",
                    models.CharField(
                        choices=[
                            ("INCOMPLETE", "Incomplete (some data pending)"),
                            ("COMPLETE", "Complete"),
                        ],
                        default="INCOMPLETE",
                        help_text=
                        "If some data is still pending, flag this CRF as incomplete",
                        max_length=25,
                        verbose_name="CRF status",
                    ),
                ),
                (
                    "crf_status_comments",
                    models.TextField(
                        blank=True,
                        help_text="for example, why some data is still pending",
                        null=True,
                        verbose_name=
                        "Any comments related to status of this CRF",
                    ),
                ),
                (
                    "stroke",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Stroke",
                    ),
                ),
                (
                    "stroke_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "heart_attack",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Heart attack / heart failure",
                    ),
                ),
                (
                    "heart_attack_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "renal_disease",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Renal (kidney) disease",
                    ),
                ),
                (
                    "renal_disease_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "vision",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Vision problems (e.g. blurred vision)",
                    ),
                ),
                (
                    "vision_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "numbness",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Numbness / burning sensation",
                    ),
                ),
                (
                    "numbness_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "foot_ulcers",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Foot ulcers",
                    ),
                ),
                (
                    "foot_ulcers_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "complications",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        default="No",
                        max_length=25,
                        verbose_name=
                        "Are there any other major complications to report?",
                    ),
                ),
                (
                    "complications_other",
                    models.TextField(blank=True,
                                     help_text="Please include dates",
                                     null=True),
                ),
                (
                    "site",
                    models.ForeignKey(
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="inte_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name":
                "Complications: Followup",
                "verbose_name_plural":
                "Complications: Followup",
                "ordering": ("-modified", "-created"),
                "get_latest_by":
                "modified",
                "abstract":
                False,
                "default_permissions": (
                    "add",
                    "change",
                    "delete",
                    "view",
                    "export",
                    "import",
                ),
            },
            managers=[
                ("on_site",
                 django.contrib.sites.managers.CurrentSiteManager()),
                ("objects", edc_visit_tracking.managers.CrfModelManager()),
            ],
        ),
        migrations.CreateModel(
            name="HistoricalComplicationsFollowup",
            fields=[
                (
                    "revision",
                    django_revision.revision_field.RevisionField(
                        blank=True,
                        editable=False,
                        help_text=
                        "System field. Git repository tag:branch:commit.",
                        max_length=75,
                        null=True,
                        verbose_name="Revision",
                    ),
                ),
                (
                    "created",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "modified",
                    models.DateTimeField(
                        blank=True,
                        default=django_audit_fields.models.audit_model_mixin.
                        utcnow,
                    ),
                ),
                (
                    "user_created",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user created",
                    ),
                ),
                (
                    "user_modified",
                    django_audit_fields.fields.userfield.UserField(
                        blank=True,
                        help_text="Updated by admin.save_model",
                        max_length=50,
                        verbose_name="user modified",
                    ),
                ),
                (
                    "hostname_created",
                    models.CharField(
                        blank=True,
                        default=_socket.gethostname,
                        help_text="System field. (modified on create only)",
                        max_length=60,
                    ),
                ),
                (
                    "hostname_modified",
                    django_audit_fields.fields.hostname_modification_field.
                    HostnameModificationField(
                        blank=True,
                        help_text="System field. (modified on every save)",
                        max_length=50,
                    ),
                ),
                ("device_created", models.CharField(blank=True,
                                                    max_length=10)),
                ("device_modified", models.CharField(blank=True,
                                                     max_length=10)),
                (
                    "id",
                    django_audit_fields.fields.uuid_auto_field.UUIDAutoField(
                        blank=True,
                        db_index=True,
                        editable=False,
                        help_text="System auto field. UUID primary key.",
                    ),
                ),
                (
                    "report_datetime",
                    models.DateTimeField(
                        default=edc_utils.date.get_utcnow,
                        help_text=
                        "If reporting today, use today's date/time, otherwise use the date/time this information was reported.",
                        validators=[
                            edc_protocol.validators.
                            datetime_not_before_study_start,
                            edc_model.models.validators.date.
                            datetime_not_future,
                        ],
                        verbose_name="Report Date",
                    ),
                ),
                (
                    "consent_model",
                    models.CharField(editable=False, max_length=50, null=True),
                ),
                (
                    "consent_version",
                    models.CharField(editable=False, max_length=10, null=True),
                ),
                (
                    "crf_status",
                    models.CharField(
                        choices=[
                            ("INCOMPLETE", "Incomplete (some data pending)"),
                            ("COMPLETE", "Complete"),
                        ],
                        default="INCOMPLETE",
                        help_text=
                        "If some data is still pending, flag this CRF as incomplete",
                        max_length=25,
                        verbose_name="CRF status",
                    ),
                ),
                (
                    "crf_status_comments",
                    models.TextField(
                        blank=True,
                        help_text="for example, why some data is still pending",
                        null=True,
                        verbose_name=
                        "Any comments related to status of this CRF",
                    ),
                ),
                (
                    "history_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    "stroke",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Stroke",
                    ),
                ),
                (
                    "stroke_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "heart_attack",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Heart attack / heart failure",
                    ),
                ),
                (
                    "heart_attack_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "renal_disease",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Renal (kidney) disease",
                    ),
                ),
                (
                    "renal_disease_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "vision",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Vision problems (e.g. blurred vision)",
                    ),
                ),
                (
                    "vision_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "numbness",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Numbness / burning sensation",
                    ),
                ),
                (
                    "numbness_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "foot_ulcers",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        max_length=25,
                        verbose_name="Foot ulcers",
                    ),
                ),
                (
                    "foot_ulcers_date",
                    models.DateField(
                        blank=True,
                        help_text=
                        "If exact date not known, see SOP on how to estimate a date.",
                        null=True,
                        verbose_name="If yes, date",
                    ),
                ),
                (
                    "complications",
                    models.CharField(
                        choices=[("Yes", "Yes"), ("No", "No")],
                        default="No",
                        max_length=25,
                        verbose_name=
                        "Are there any other major complications to report?",
                    ),
                ),
                (
                    "complications_other",
                    models.TextField(blank=True,
                                     help_text="Please include dates",
                                     null=True),
                ),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "site",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="sites.Site",
                    ),
                ),
                (
                    "subject_visit",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="inte_subject.SubjectVisit",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Complications: Followup",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name="clinicalreview",
            name="complications",
            field=models.CharField(
                choices=[("Yes", "Yes"), ("No", "No")],
                default="No",
                help_text="If Yes, complete the `Complications` CRF",
                max_length=15,
                verbose_name=
                "Since last seen, has the patient had any complications",
            ),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name="historicalclinicalreview",
            name="complications",
            field=models.CharField(
                choices=[("Yes", "Yes"), ("No", "No")],
                default="No",
                help_text="If Yes, complete the `Complications` CRF",
                max_length=15,
                verbose_name=
                "Since last seen, has the patient had any complications",
            ),
            preserve_default=False,
        ),
        migrations.AddIndex(
            model_name="complicationsfollowup",
            index=models.Index(
                fields=["subject_visit", "site", "id"],
                name="inte_subjec_subject_c92cd4_idx",
            ),
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("datasets", "0020_auto_20200718_2347"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalCityCouncilAttendanceList",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Criado em"),
                ),
                (
                    "updated_at",
                    models.DateTimeField(blank=True,
                                         editable=False,
                                         verbose_name="Atualizado em"),
                ),
                ("crawled_at",
                 models.DateTimeField(verbose_name="Coletado em")),
                ("crawled_from", models.URLField(verbose_name="Fonte")),
                (
                    "notes",
                    models.TextField(blank=True,
                                     null=True,
                                     verbose_name="Anotações"),
                ),
                ("date", models.DateField(verbose_name="Data")),
                (
                    "description",
                    models.CharField(blank=True,
                                     max_length=200,
                                     null=True,
                                     verbose_name="Descrição"),
                ),
                (
                    "council_member",
                    models.CharField(db_index=True,
                                     max_length=200,
                                     verbose_name="Vereador"),
                ),
                (
                    "status",
                    models.CharField(
                        choices=[
                            ("presente", "Presente"),
                            ("falta_justificada", "Falta Justificada"),
                            ("licenca_justificada", "Licença Justificada"),
                            ("ausente", "Ausente"),
                        ],
                        db_index=True,
                        max_length=20,
                        verbose_name="Situação",
                    ),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name":
                "historical Câmara de Vereadores - Lista de Presença",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
示例#13
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("tests", "0014_auto_20200327_1152"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalModelTest",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                ("char_field",
                 models.CharField(max_length=255, verbose_name="Char")),
                ("text_field", models.TextField(blank=True, null=True)),
                ("integer_field", models.IntegerField()),
                ("float_field", models.FloatField()),
                ("decimal_field",
                 models.DecimalField(decimal_places=4, max_digits=7)),
                ("percent_field", models.FloatField()),
                ("datetime_field",
                 models.DateTimeField(verbose_name="DateTime")),
                ("datetime_field1",
                 models.DateTimeField(verbose_name="DateTime 1")),
                ("date_field", models.DateField()),
                ("time_field", models.TimeField()),
                ("boolean_field", models.BooleanField()),
                (
                    "choice_field",
                    models.CharField(choices=[("a", "A"), ("b", "B")],
                                     default="a",
                                     max_length=64),
                ),
                (
                    "status_field",
                    django_fsm.FSMField(
                        choices=[
                            ("status1", "Status1"),
                            ("status2", "Status2"),
                            ("status3", "Status3"),
                        ],
                        default="status1",
                        max_length=50,
                        verbose_name="Status",
                    ),
                ),
                ("image_field", models.TextField(max_length=100, null=True)),
                ("file_field", models.TextField(max_length=100, null=True)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_date", models.DateTimeField()),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical Test Model",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
示例#14
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('project', '0001_initial'),
        ('resources', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='AttributeType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=64)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='HistoricalSubscription',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('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')),
                ('quantity', models.IntegerField(default=1)),
                ('active_until', models.DateField(blank=True, null=True)),
                ('justification', models.TextField()),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_date', models.DateTimeField()),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('project', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='project.Project')),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical subscription',
                'ordering': ('-history_date', '-history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalSubscriptionAttribute',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('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')),
                ('value', models.CharField(max_length=128)),
                ('is_private', models.BooleanField(default=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_date', models.DateTimeField()),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical subscription attribute',
                'ordering': ('-history_date', '-history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalSubscriptionAttributeType',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=50)),
                ('has_usage', models.BooleanField(default=False)),
                ('is_required', models.BooleanField(default=False)),
                ('is_unique', models.BooleanField(default=False)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_date', models.DateTimeField()),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('attribute_type', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.AttributeType')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical subscription attribute type',
                'ordering': ('-history_date', '-history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalSubscriptionAttributeUsage',
            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')),
                ('value', models.FloatField(default=0)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_date', models.DateTimeField()),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical subscription attribute usage',
                'ordering': ('-history_date', '-history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalSubscriptionUser',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('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')),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_date', models.DateTimeField()),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'get_latest_by': 'history_date',
                'verbose_name': 'historical subscription user',
                'ordering': ('-history_date', '-history_id'),
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='Subscription',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('quantity', models.IntegerField(default=1)),
                ('active_until', models.DateField(blank=True, null=True)),
                ('justification', models.TextField()),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='project.Project')),
                ('resources', models.ManyToManyField(to='resources.Resource')),
            ],
            options={
                'permissions': (('can_view_all_subscriptions', 'Can see all subscriptions'), ('can_review_subscription_requests', 'Can review subscription requests')),
                'ordering': ['active_until'],
            },
        ),
        migrations.CreateModel(
            name='SubscriptionAdminComment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('comment', models.TextField()),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('subscription', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.Subscription')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SubscriptionAttribute',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('value', models.CharField(max_length=128)),
                ('is_private', models.BooleanField(default=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SubscriptionAttributeType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=50)),
                ('has_usage', models.BooleanField(default=False)),
                ('is_required', models.BooleanField(default=False)),
                ('is_unique', models.BooleanField(default=False)),
                ('attribute_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.AttributeType')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='SubscriptionStatusChoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=64)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='SubscriptionUser',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
            ],
            options={
                'verbose_name_plural': 'Subscription User Status',
            },
        ),
        migrations.CreateModel(
            name='SubscriptionUserMessage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('message', models.TextField()),
                ('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
                ('subscription', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.Subscription')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SubscriptionUserStatusChoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('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')),
                ('name', models.CharField(max_length=64)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='SubscriptionAttributeUsage',
            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')),
                ('subscription_attribute', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='subscription.SubscriptionAttribute')),
                ('value', models.FloatField(default=0)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='subscriptionuser',
            name='status',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.SubscriptionUserStatusChoice', verbose_name='Subscription User Status'),
        ),
        migrations.AddField(
            model_name='subscriptionuser',
            name='subscription',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.Subscription'),
        ),
        migrations.AddField(
            model_name='subscriptionuser',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='subscriptionattribute',
            name='subscription',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.Subscription'),
        ),
        migrations.AddField(
            model_name='subscriptionattribute',
            name='subscription_attribute_type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.SubscriptionAttributeType'),
        ),
        migrations.AddField(
            model_name='subscription',
            name='status',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subscription.SubscriptionStatusChoice', verbose_name='Status'),
        ),
        migrations.AddField(
            model_name='historicalsubscriptionuser',
            name='status',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.SubscriptionUserStatusChoice'),
        ),
        migrations.AddField(
            model_name='historicalsubscriptionuser',
            name='subscription',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.Subscription'),
        ),
        migrations.AddField(
            model_name='historicalsubscriptionuser',
            name='user',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='historicalsubscriptionattributeusage',
            name='subscription_attribute',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.SubscriptionAttribute'),
        ),
        migrations.AddField(
            model_name='historicalsubscriptionattribute',
            name='subscription',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.Subscription'),
        ),
        migrations.AddField(
            model_name='historicalsubscriptionattribute',
            name='subscription_attribute_type',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.SubscriptionAttributeType'),
        ),
        migrations.AddField(
            model_name='historicalsubscription',
            name='status',
            field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='subscription.SubscriptionStatusChoice'),
        ),
        migrations.AlterUniqueTogether(
            name='subscriptionuser',
            unique_together={('user', 'subscription')},
        ),
    ]
示例#15
0
class Migration(migrations.Migration):

    dependencies = [
        ("metadata", "0006_auto_20180903_1349"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("barriers", "0010_auto_20180912_1831"),
    ]

    operations = [
        migrations.CreateModel(
            name="HistoricalBarrierCompany",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_on",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         null=True),
                ),
                (
                    "modified_on",
                    models.DateTimeField(blank=True, editable=False,
                                         null=True),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                ("history_date", models.DateTimeField()),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "barrier",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="barriers.BarrierInstance",
                    ),
                ),
                (
                    "company",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="barriers.DatahubCompany",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical barrier company",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalBarrierContributor",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_on",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         null=True),
                ),
                (
                    "modified_on",
                    models.DateTimeField(blank=True, editable=False,
                                         null=True),
                ),
                (
                    "kind",
                    models.CharField(
                        choices=[
                            ("INITIATOR", "Initiator"),
                            ("CONTRIBUTOR", "Contributor"),
                            ("LEAD", "Lead"),
                        ],
                        max_length=25,
                    ),
                ),
                ("is_active", models.BooleanField(default=True)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                ("history_date", models.DateTimeField()),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "barrier",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="barriers.BarrierInstance",
                    ),
                ),
                (
                    "contributor",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical barrier contributor",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalBarrierInstance",
            fields=[
                (
                    "created_on",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         null=True),
                ),
                (
                    "modified_on",
                    models.DateTimeField(blank=True, editable=False,
                                         null=True),
                ),
                ("id", models.UUIDField(db_index=True, default=uuid.uuid4)),
                (
                    "problem_status",
                    models.PositiveIntegerField(
                        choices=[
                            (1, "On the border"),
                            (2, "Long term strategic barrier"),
                        ],
                        null=True,
                    ),
                ),
                ("is_resolved", models.NullBooleanField()),
                ("resolved_date", models.DateField(default=None, null=True)),
                ("export_country", models.UUIDField(null=True)),
                ("sectors_affected", models.NullBooleanField()),
                (
                    "sectors",
                    django.contrib.postgres.fields.ArrayField(
                        base_field=models.UUIDField(),
                        blank=True,
                        default=None,
                        null=True,
                        size=None,
                    ),
                ),
                ("product", models.CharField(max_length=255, null=True)),
                (
                    "source",
                    models.CharField(
                        choices=[
                            ("COMPANY", "Company"),
                            ("TRADE", "Trade Association"),
                            ("GOVT", "Government Lead"),
                            ("OTHER", "Other"),
                        ],
                        help_text="chance of success",
                        max_length=25,
                        null=True,
                    ),
                ),
                ("other_source", models.CharField(max_length=255, null=True)),
                ("barrier_title", models.CharField(max_length=255, null=True)),
                ("problem_description", models.TextField(null=True)),
                (
                    "reported_on",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False),
                ),
                (
                    "status",
                    models.PositiveIntegerField(
                        choices=[
                            (0, "Unfinished"),
                            (1, "Screening"),
                            (2, "Open"),
                            (3, "Rejected"),
                            (4, "Resolved"),
                            (5, "Hibernated"),
                            (6, "Archived"),
                        ],
                        default=0,
                        help_text="status of the barrier instance",
                    ),
                ),
                (
                    "status_summary",
                    models.TextField(
                        default=None,
                        help_text="status summary if provided by user",
                        null=True,
                    ),
                ),
                (
                    "status_date",
                    models.DateTimeField(
                        blank=True,
                        editable=False,
                        help_text="date when status action occurred",
                        null=True,
                    ),
                ),
                (
                    "has_legal_infringement",
                    models.PositiveIntegerField(
                        choices=[(1, "Yes"), (2, "No"), (3, "Don't know")],
                        default=None,
                        help_text="Legal obligations infringed",
                        null=True,
                    ),
                ),
                (
                    "wto_infringement",
                    models.NullBooleanField(
                        default=None, help_text="Legal obligations infringed"),
                ),
                (
                    "fta_infringement",
                    models.NullBooleanField(
                        default=None, help_text="Legal obligations infringed"),
                ),
                (
                    "other_infringement",
                    models.NullBooleanField(
                        default=None, help_text="Legal obligations infringed"),
                ),
                (
                    "infringement_summary",
                    models.TextField(default=None,
                                     help_text="Summary of infringments",
                                     null=True),
                ),
                (
                    "political_sensitivities",
                    models.TextField(
                        default=None,
                        help_text="Political sensitivities to be aware of",
                        null=True,
                    ),
                ),
                (
                    "commercial_sensitivities",
                    models.TextField(
                        default=None,
                        help_text=
                        "Commercial or confidentiality sensitivities to be aware of",
                        null=True,
                    ),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                ("history_date", models.DateTimeField()),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "barrier_type",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="metadata.BarrierType",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical barrier instance",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalBarrierInteraction",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_on",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         null=True),
                ),
                (
                    "modified_on",
                    models.DateTimeField(blank=True, editable=False,
                                         null=True),
                ),
                (
                    "kind",
                    models.CharField(choices=[("COMMENT", "Comment")],
                                     max_length=25),
                ),
                ("text", models.TextField(null=True)),
                ("pinned", models.BooleanField(default=False)),
                ("is_active", models.BooleanField(default=True)),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                ("history_date", models.DateTimeField()),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "barrier",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="barriers.BarrierInstance",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "historical barrier interaction",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name="HistoricalBarrierReportStage",
            fields=[
                (
                    "id",
                    models.IntegerField(auto_created=True,
                                        blank=True,
                                        db_index=True,
                                        verbose_name="ID"),
                ),
                (
                    "created_on",
                    models.DateTimeField(blank=True,
                                         db_index=True,
                                         editable=False,
                                         null=True),
                ),
                (
                    "modified_on",
                    models.DateTimeField(blank=True, editable=False,
                                         null=True),
                ),
                (
                    "status",
                    models.PositiveIntegerField(
                        choices=[
                            (1, "NOT STARTED"),
                            (2, "IN PROGRESS"),
                            (3, "COMPLETED"),
                        ],
                        null=True,
                    ),
                ),
                ("history_id",
                 models.AutoField(primary_key=True, serialize=False)),
                ("history_change_reason",
                 models.CharField(max_length=100, null=True)),
                ("history_date", models.DateTimeField()),
                (
                    "history_type",
                    models.CharField(
                        choices=[("+", "Created"), ("~", "Changed"),
                                 ("-", "Deleted")],
                        max_length=1,
                    ),
                ),
                (
                    "barrier",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="barriers.BarrierInstance",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "history_user",
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "stage",
                    models.ForeignKey(
                        blank=True,
                        db_constraint=False,
                        null=True,
                        on_delete=django.db.models.deletion.DO_NOTHING,
                        related_name="+",
                        to="barriers.Stage",
                    ),
                ),
            ],
            options={
                "verbose_name": "historical barrier report stage",
                "ordering": ("-history_date", "-history_id"),
                "get_latest_by": "history_date",
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]