Exemplo n.º 1
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name='UserSession',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('loggedin', models.DateTimeField(auto_now_add=True)),
                ('loggedout', models.DateTimeField(default=None, null=True)),
                ('headers',
                 django.contrib.postgres.fields.jsonb.JSONField(
                     default=dict, encoder=audit.models.SafeEncoder)),
                ('session',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='sessions.Session')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
    ]
Exemplo n.º 2
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name="Organisation",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(max_length=500)),
                ("datahub_id", models.CharField(blank=True, max_length=150, null=True)),
                ("companies_house_id", models.CharField(blank=True, max_length=50, null=True)),
                ("trade_association", models.BooleanField(default=False)),
                ("address", models.TextField(blank=True, null=True)),
                ("post_code", models.CharField(blank=True, max_length=16, null=True)),
                (
                    "country",
                    django_countries.fields.CountryField(blank=True, max_length=2, null=True),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="organisation_created_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="organisation_modified_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.AlterUniqueTogether(name="organisation", unique_together={("name", "country")},),
    ]
Exemplo n.º 3
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("cases", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Content",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(max_length=250)),
                ("short_name", models.CharField(blank=True, max_length=100, null=True)),
                ("order", models.SmallIntegerField(default=0)),
                ("content", models.TextField(blank=True, null=True)),
                (
                    "case",
                    models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to="cases.Case"),
                ),
            ],
            options={"abstract": False,},
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
    ]
Exemplo n.º 4
0
class Migration(migrations.Migration):

    initial = True

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

    operations = [
        migrations.CreateModel(
            name="Document",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(max_length=1000)),
                (
                    "file",
                    models.FileField(max_length=1000, upload_to=documents.utils.upload_document_to),
                ),
                ("size", models.IntegerField(blank=True, null=True)),
                ("virus_scanned_at", models.DateTimeField(blank=True, null=True)),
                ("safe", models.NullBooleanField()),
                ("system", models.BooleanField(default=False)),
                ("checksum", models.CharField(blank=True, max_length=32, null=True)),
                ("confidential", models.BooleanField(default=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="document_created_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="document_modified_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "parent",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="documents.Document",
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
    ]
Exemplo n.º 5
0
class Migration(migrations.Migration):

    initial = True

    dependencies = []

    operations = [
        migrations.CreateModel(
            name="ArchiveReason",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name="ID"),
                ),
                ("name", models.CharField(max_length=250)),
                ("key", models.CharField(blank=True, max_length=250,
                                         null=True)),
            ],
        ),
        migrations.CreateModel(
            name="Case",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("sequence",
                 models.IntegerField(blank=True, null=True, unique=True)),
                ("name", models.CharField(blank=True,
                                          max_length=250,
                                          null=True)),
                ("initiated_at", models.DateTimeField(blank=True, null=True)),
                ("submitted_at", models.DateTimeField(blank=True, null=True)),
                ("archived_at", models.DateTimeField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="CaseDocument",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="CaseDocumentType",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name="ID"),
                ),
                ("name", models.CharField(max_length=150)),
            ],
        ),
        migrations.CreateModel(
            name="CaseStage",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("key", models.CharField(max_length=100, unique=True)),
                ("name", models.CharField(max_length=100)),
                ("public_name",
                 models.CharField(blank=True, max_length=150, null=True)),
                ("order", models.SmallIntegerField(default=0)),
                ("locking", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="CaseTimeGate",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("ack", models.BooleanField(default=False)),
                ("ack_at", models.DateTimeField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="CaseType",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name="ID"),
                ),
                ("name", models.CharField(max_length=150)),
                ("acronym",
                 models.CharField(blank=True, max_length=4, null=True)),
                ("colour",
                 models.CharField(blank=True, max_length=16, null=True)),
            ],
        ),
        migrations.CreateModel(
            name="CaseWorkflow",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("workflow",
                 django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="CaseWorkflowState",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("key", models.CharField(max_length=250)),
                ("value",
                 django.contrib.postgres.fields.jsonb.JSONField(blank=True,
                                                                null=True)),
                ("due_date", models.DateTimeField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="DocumentTemplate",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("downloaded", models.BooleanField(default=False)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="ExportSource",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("country",
                 django_countries.fields.CountryField(max_length=2)),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="HSCode",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("code", models.CharField(max_length=50, unique=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="Product",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(blank=True,
                                          max_length=250,
                                          null=True)),
                ("description", models.TextField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="Sector",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name="ID"),
                ),
                ("name", models.CharField(max_length=250)),
                ("code", models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name="Submission",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(blank=True,
                                          max_length=500,
                                          null=True)),
                ("review", models.NullBooleanField()),
                ("doc_reviewed_at", models.DateTimeField(blank=True,
                                                         null=True)),
                ("version", models.SmallIntegerField(default=1)),
                ("sent_at", models.DateTimeField(blank=True, null=True)),
                ("received_at", models.DateTimeField(blank=True, null=True)),
                ("due_at", models.DateTimeField(blank=True, null=True)),
                ("deficiency_notice", models.TextField(blank=True, null=True)),
                ("deficiency_sent_at",
                 models.DateTimeField(blank=True, null=True)),
                ("archived", models.BooleanField(default=False)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="SubmissionDocument",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("downloads", models.SmallIntegerField(default=0)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("issued", models.BooleanField(default=False)),
                ("issued_at", models.DateTimeField(blank=True, null=True)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="SubmissionStatus",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name="ID"),
                ),
                ("name", models.CharField(max_length=100)),
                ("order", models.SmallIntegerField(default=0)),
                ("locking", models.BooleanField(default=False)),
                ("version", models.BooleanField(default=False)),
                ("duration", models.SmallIntegerField(blank=True, null=True)),
                ("default", models.BooleanField(default=False)),
                ("sent", models.BooleanField(default=False)),
                ("received", models.BooleanField(default=False)),
                ("sufficient", models.BooleanField(default=False)),
                ("review", models.BooleanField(default=False)),
            ],
        ),
        migrations.CreateModel(
            name="SubmissionType",
            fields=[
                (
                    "id",
                    models.AutoField(auto_created=True,
                                     primary_key=True,
                                     serialize=False,
                                     verbose_name="ID"),
                ),
                ("name", models.CharField(max_length=150)),
                ("key", models.CharField(blank=True, max_length=50,
                                         null=True)),
                (
                    "direction",
                    models.IntegerField(
                        choices=[
                            (-1, "None"),
                            (0, "Both"),
                            (1, "Public -> TRA"),
                            (2, "Public <- TRA"),
                        ],
                        default=0,
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="TimeGate",
            fields=[
                (
                    "id",
                    models.UUIDField(default=uuid.uuid4,
                                     editable=False,
                                     primary_key=True,
                                     serialize=False),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True,
                                                       null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(max_length=250)),
                ("spec",
                 django.contrib.postgres.fields.jsonb.JSONField(default=dict)),
            ],
            options={
                "abstract": False,
            },
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
    ]
Exemplo n.º 6
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='CostType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='成本类型')),
            ],
        ),
        migrations.CreateModel(
            name='CouponItem',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=200, verbose_name='名称')),
            ],
        ),
        migrations.CreateModel(
            name='Member',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, unique=True, verbose_name='名称')),
                ('phone', models.CharField(max_length=200, verbose_name='手机')),
            ],
        ),
        migrations.CreateModel(
            name='ProductType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='无', max_length=50, verbose_name='产品类型')),
            ],
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=50, verbose_name='单位')),
            ],
        ),
        migrations.CreateModel(
            name='Product',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('_price', models.IntegerField(default=0, verbose_name='价格')),
                ('insert_time', models.DateTimeField(auto_now_add=True, verbose_name='插入时间')),
                ('old', models.BooleanField(default=False, verbose_name='是否旧价格')),
                ('types', models.ForeignKey(on_delete=models.SET(audit.models.default_product_type), to='audit.ProductType', verbose_name='产品类型')),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_id', models.IntegerField(default=0, verbose_name='订单ID')),
                ('number', models.IntegerField(default=0, verbose_name='数量')),
                ('sale_time', models.DateTimeField(auto_now_add=True, verbose_name='销售时间')),
                ('state', models.IntegerField(choices=[(0, '未结清'), (1, '已结清')], default=1)),
                ('discount', models.FloatField(default=1, verbose_name='折扣')),
                ('member', models.ForeignKey(on_delete=models.SET(audit.models.default_member), to='audit.Member', verbose_name='会员')),
                ('product', models.ForeignKey(on_delete=models.SET(audit.models.default_product), to='audit.Product', verbose_name='产品')),
            ],
        ),
        migrations.CreateModel(
            name='Coupon',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.IntegerField(default=0)),
                ('exchange', models.IntegerField(default=0, verbose_name='兑换次数')),
                ('coupon', models.ForeignKey(on_delete=models.SET(audit.models.default_coupon_item), to='audit.CouponItem', verbose_name='优惠券')),
                ('user', models.ForeignKey(on_delete=models.SET(audit.models.default_member), to='audit.Member', verbose_name='用户')),
            ],
        ),
        migrations.CreateModel(
            name='Cost',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(default='', max_length=200, verbose_name='名称')),
                ('number', models.FloatField(default=0, verbose_name='数量')),
                ('source', models.TextField(verbose_name='来源')),
                ('_price', models.IntegerField(default=0, verbose_name='价格')),
                ('buy_time', models.DateTimeField(auto_now_add=True, verbose_name='购买时间')),
                ('state', models.IntegerField(choices=[(0, '未结清'), (1, '已结清')], default=1, verbose_name='状态')),
                ('costtype', models.ForeignKey(on_delete=models.SET(audit.models.default_costtype), to='audit.CostType', verbose_name='成本类型')),
                ('unit', models.ForeignKey(on_delete=models.SET(audit.models.default_unit), to='audit.Unit', verbose_name='单位')),
            ],
        ),
    ]
Exemplo n.º 7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("contenttypes", "0002_remove_content_type_name"),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("cases", "0002_auto_20181015_1444"),
        ("documents", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="Note",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("note", models.TextField(blank=True, null=True)),
                ("model_id", models.UUIDField()),
                (
                    "case",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.PROTECT,
                        to="cases.Case",
                    ),
                ),
                (
                    "content_type",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT, to="contenttypes.ContentType"
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="note_created_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                ("documents", models.ManyToManyField(blank=True, to="documents.Document")),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="note_modified_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.AlterIndexTogether(name="note", index_together={("content_type", "model_id")},),
    ]
Exemplo n.º 8
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("cases", "0002_auto_20181015_1444"),
        ("auth", "0009_alter_user_last_name_max_length"),
        ("organisations", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="CaseAction",
            fields=[
                ("id", models.CharField(max_length=50, primary_key=True, serialize=False)),
                ("name", models.CharField(max_length=50)),
            ],
        ),
        migrations.CreateModel(
            name="CaseRole",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("name", models.CharField(max_length=100)),
                ("key", models.CharField(blank=True, max_length=100, null=True, unique=True)),
                ("order", models.SmallIntegerField(default=0)),
                ("plural", models.CharField(blank=True, max_length=100, null=True)),
                ("actions", models.ManyToManyField(to="security.CaseAction")),
            ],
        ),
        migrations.CreateModel(
            name="OrganisationCaseRole",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("sampled", models.BooleanField(default=False)),
                ("non_responsive", models.BooleanField(default=False)),
                (
                    "case",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="cases.Case"),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="organisationcaserole_created_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="organisationcaserole_modified_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "organisation",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="organisations.Organisation"
                    ),
                ),
                (
                    "role",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="security.CaseRole"
                    ),
                ),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="OrganisationUser",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("confirmed", models.BooleanField(default=True)),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="organisationuser_created_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="organisationuser_modified_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "organisation",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="organisations.Organisation"
                    ),
                ),
                (
                    "security_group",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="auth.Group",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="UserCase",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                (
                    "case",
                    models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="cases.Case"),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="usercase_created_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "modified_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="usercase_modified_by",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "organisation",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to="organisations.Organisation",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.AlterUniqueTogether(
            name="usercase", unique_together={("user", "case", "organisation")},
        ),
        migrations.AlterUniqueTogether(
            name="organisationuser", unique_together={("organisation", "user")},
        ),
        migrations.AlterUniqueTogether(
            name="organisationcaserole", unique_together={("organisation", "case")},
        ),
    ]
Exemplo n.º 9
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ("cases", "0001_initial"),
    ]

    operations = [
        migrations.CreateModel(
            name="CaseContact",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("primary", models.BooleanField(default=False)),
            ],
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="Contact",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                ("deleted_at", models.DateTimeField(blank=True, null=True)),
                ("name", models.CharField(max_length=250)),
                ("email", models.EmailField(blank=True, max_length=254, null=True)),
                ("phone", models.CharField(blank=True, max_length=80, null=True)),
                ("address", models.TextField(blank=True, null=True)),
                ("post_code", models.CharField(blank=True, max_length=16, null=True)),
                (
                    "country",
                    django_countries.fields.CountryField(blank=True, max_length=2, null=True),
                ),
            ],
            options={"abstract": False,},
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
        migrations.CreateModel(
            name="ContactUser",
            fields=[
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4, editable=False, primary_key=True, serialize=False
                    ),
                ),
                ("created_at", models.DateTimeField(auto_now_add=True)),
                ("last_modified", models.DateTimeField(auto_now=True, null=True)),
                (
                    "case",
                    models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to="cases.Case"),
                ),
                (
                    "contact",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT, to="contacts.Contact"
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=(
                models.Model,
                dirtyfields.dirtyfields.DirtyFieldsMixin,
                audit.mixins.AuditableMixin,
            ),
        ),
    ]