Beispiel #1
0
class Project(models.Model):
    name = models.CharField(max_length=128, unique=True)
    description = models.TextField(blank=True)
    owner = models.ForeignKey(settings.AUTH_USER_MODEL,
                              on_delete=models.SET_NULL,
                              null=True,
                              default=None)

    service = models.ForeignKey('Service', on_delete=models.CASCADE)
    shard = models.ForeignKey('Shard', on_delete=models.CASCADE)
    farm = models.ForeignKey('Farm',
                             blank=True,
                             null=True,
                             on_delete=models.SET_NULL)

    notifiers = GenericRelation(Sender)
    rule_set = GenericRelation('Rule')

    class Meta:
        ordering = ['name']

    def get_absolute_url(self):
        return reverse('project-detail', kwargs={'pk': self.pk})

    def __str__(self):
        return '{} » {}'.format(self.service, self.name)
Beispiel #2
0
class Service(models.Model):
    name = models.CharField(max_length=128, unique=True)
    description = models.TextField(blank=True)
    owner = models.ForeignKey(settings.AUTH_USER_MODEL,
                              on_delete=models.SET_NULL,
                              null=True,
                              default=None)

    notifiers = GenericRelation(Sender)
    rule_set = GenericRelation('Rule')

    class Meta:
        ordering = ['name']

    def get_absolute_url(self):
        return reverse('service-detail', kwargs={'pk': self.pk})

    def __str__(self):
        return self.name

    @classmethod
    def default(cls, service_name='Default', shard_name='Default'):
        shard, created = Shard.objects.get_or_create(name=shard_name)
        if created:
            logger.info('Created default shard')

        service, created = cls.objects.get_or_create(name=service_name,
                                                     defaults={'shard': shard})
        if created:
            logger.info('Created default service')
        return service
Beispiel #3
0
class Alert(models.Model):
    created = models.DateTimeField(default=timezone.now)
    body = models.TextField()

    def expand(self):
        # Map of Prometheus labels to Promgen objects
        LABEL_MAPPING = [
            ('project', Project),
            ('service', Service),
        ]
        routable = {}
        data = json.loads(self.body)

        data.setdefault('commonLabels', {})
        data.setdefault('commonAnnotations', {})

        # Look through our labels and find the object from Promgen's DB
        # If we find an object in Promgen, add an annotation with a direct link
        for label, klass in LABEL_MAPPING:
            if label not in data['commonLabels']:
                logger.debug('Missing label %s', label)
                continue

            # Should only find a single value, but I think filter is a little
            # bit more forgiving than get in terms of throwing errors
            for obj in klass.objects.filter(name=data['commonLabels'][label]):
                logger.debug('Found %s %s', label, obj)
                routable[label] = obj
                data['commonAnnotations'][label] = resolve_domain(obj)

        return routable, data

    @cached_property
    def json(self):
        return json.loads(self.body)
Beispiel #4
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('myprofile', '0002_auto_20190416_0656'),
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='Config',
            fields=[
                ('site_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='sites.Site')),
                ('site', models.CharField(blank=True,
                                          max_length=255,
                                          null=True)),
                ('keywords',
                 models.CharField(blank=True, max_length=255, null=True)),
                ('google_maps', models.TextField(blank=True, null=True)),
                ('logo',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='uploads/config')),
                ('icon',
                 models.ImageField(blank=True,
                                   null=True,
                                   upload_to='uploads/config')),
                ('about', models.TextField(blank=True, null=True)),
                ('metatext', models.TextField(blank=True, null=True)),
                ('myprofile',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='myprofile.Myprofile')),
            ],
            bases=('sites.site', ),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
    ]
Beispiel #5
0
class Audit(models.Model):
    body = models.TextField()
    created = models.DateTimeField()
    data = models.TextField(blank=True)
    old = models.TextField(blank=True)

    content_type = models.ForeignKey(ContentType,
                                     on_delete=models.CASCADE,
                                     null=True)
    object_id = models.PositiveIntegerField(default=0)
    content_object = GenericForeignKey('content_type', 'object_id')

    user = models.ForeignKey(settings.AUTH_USER_MODEL,
                             on_delete=models.SET_NULL,
                             null=True,
                             default=None)

    @property
    def hilight(self):
        if self.body.startswith('Created'):
            return 'success'
        if self.body.startswith('Updated'):
            return 'warning'
        if self.body.startswith('Deleted'):
            return 'danger'
        return ''

    @classmethod
    def log(cls, body, instance=None, old=None, **kwargs):
        from promgen.middleware import get_current_user

        kwargs['body'] = body
        kwargs['created'] = timezone.now()
        kwargs['user'] = get_current_user()

        if instance:
            kwargs['content_type'] = ContentType.objects.get_for_model(
                instance)
            kwargs['object_id'] = instance.id
            kwargs['data'] = json.dumps(model_to_dict(instance),
                                        sort_keys=True)
        if old:
            kwargs['old'] = json.dumps(model_to_dict(old), sort_keys=True)

        return cls.objects.create(**kwargs)
Beispiel #6
0
class Probe(models.Model):
    module = models.CharField(
        help_text='Probe Module from blackbox_exporter config',
        max_length=128,
        unique=True)
    description = models.TextField(blank=True)

    def __str__(self):
        return "{} » {}".format(self.module, self.description)
Beispiel #7
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='ProxySite',
            fields=[],
            options={
                'verbose_name': 'site',
                'verbose_name_plural': 'sites',
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('sites.site', ),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.CreateModel(
            name='SiteProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('extra_head', models.TextField(blank=True, default='')),
                ('site',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='profile',
                     to='sites.Site')),
            ],
            options={
                'verbose_name': 'profile',
            },
        ),
    ]
Beispiel #8
0
class Alert(models.Model):
    created = models.DateTimeField(default=timezone.now)
    body = models.TextField()
    sent_count = models.PositiveIntegerField(default=0)
    error_count = models.PositiveIntegerField(default=0)

    def get_absolute_url(self):
        return reverse("alert-detail", kwargs={"pk": self.pk})

    def expand(self):
        # Map of Prometheus labels to Promgen objects
        LABEL_MAPPING = [
            ('project', Project),
            ('service', Service),
        ]
        routable = {}
        data = json.loads(self.body)

        data.setdefault('commonLabels', {})
        data.setdefault('commonAnnotations', {})
        # Set our link back to Promgen for processed notifications
        # The original externalURL can still be visible from the alerts page
        data['externalURL'] = resolve_domain(self.get_absolute_url())

        # Look through our labels and find the object from Promgen's DB
        # If we find an object in Promgen, add an annotation with a direct link
        for label, klass in LABEL_MAPPING:
            if label not in data['commonLabels']:
                logger.debug('Missing label %s', label)
                continue

            # Should only find a single value, but I think filter is a little
            # bit more forgiving than get in terms of throwing errors
            for obj in klass.objects.filter(name=data['commonLabels'][label]):
                logger.debug('Found %s %s', label, obj)
                routable[label] = obj
                data['commonAnnotations'][label] = resolve_domain(obj)

        return routable, data

    @cached_property
    def json(self):
        return json.loads(self.body)
Beispiel #9
0
class Service(models.Model):
    name = models.CharField(max_length=128, unique=True)
    notifiers = GenericRelation(Sender)
    rule_set = GenericRelation('Rule')
    shard = models.ForeignKey('Shard', on_delete=models.CASCADE)
    description = models.TextField(blank=True)

    owner = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.SET_NULL, null=True, default=None)

    class Meta:
        ordering = ['shard', 'name']

    def get_absolute_url(self):
        return reverse('service-detail', kwargs={'pk': self.pk})

    def __str__(self):
        return '{} » {}'.format(self.shard.name, self.name)

    @classmethod
    def default(cls, service_name='Default', shard_name='Default'):
        shard, created = Shard.objects.get_or_create(
            name=shard_name
        )
        if created:
            logger.info('Created default shard')

        service, created = cls.objects.get_or_create(
            name=service_name,
            defaults={'shard': shard}
        )
        if created:
            logger.info('Created default service')
        return service

    @property
    def check_notifiers(self):
        if self.notifiers.count() > 0:
            return True
        for project in self.project_set.all():
            if project.notifiers.count() == 0:
                return False
        return True
Beispiel #10
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [("sites", "0002_alter_domain_unique")]

    operations = [
        migrations.CreateModel(
            name="EdcSite",
            fields=[],
            options={
                "proxy": True,
                "indexes": [],
                "constraints": []
            },
            bases=("sites.site", ),
            managers=[("objects", django.contrib.sites.models.SiteManager())],
        ),
        migrations.CreateModel(
            name="SiteProfile",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True,
                        primary_key=True,
                        serialize=False,
                        verbose_name="ID",
                    ),
                ),
                ("title", models.CharField(max_length=50, null=True)),
                ("description", models.TextField(null=True)),
                (
                    "site",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="sites.Site"),
                ),
            ],
        ),
    ]
Beispiel #11
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='EdcSite',
            fields=[],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('sites.site', ),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.CreateModel(
            name='SiteProfile',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('title', models.CharField(max_length=250, null=True)),
                ('description', models.TextField(null=True)),
                ('site',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.PROTECT,
                     to='sites.Site')),
            ],
        ),
    ]
class Migration(migrations.Migration):

    dependencies = [
        ('sites', '0003_set_site_domain_and_name'),
        ('content', '0018_delete_generalinformation'),
    ]

    operations = [
        migrations.CreateModel(
            name='GeneralInformation',
            fields=[
                ('site_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='sites.Site')),
                ('public_email',
                 models.EmailField(blank=True,
                                   help_text='Public facing contact email.',
                                   max_length=200,
                                   null=True,
                                   verbose_name='Email')),
                ('about_description',
                 models.TextField(blank=True,
                                  help_text='Max length 1000 characters',
                                  max_length=1000,
                                  null=True,
                                  verbose_name='About Description')),
            ],
            bases=('sites.site', ),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
    ]
Beispiel #13
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ("sites", "0002_alter_domain_unique"),
        ("raiden", "0001_initial"),
        ("blockchain", "0001_initial"),
        ("ethereum_money", "0001_initial"),
        migrations.swappable_dependency(settings.ETHEREUM_ACCOUNT_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name="Payment",
            fields=[
                (
                    "amount",
                    hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                        decimal_places=18, max_digits=32
                    ),
                ),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                ("id", models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                (
                    "currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="ethereum_money.EthereumToken",
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="PaymentOrder",
            fields=[
                (
                    "amount",
                    hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                        decimal_places=18, max_digits=32
                    ),
                ),
                (
                    "created",
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="created"
                    ),
                ),
                (
                    "modified",
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now, editable=False, verbose_name="modified"
                    ),
                ),
                ("id", models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                (
                    "chain",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="blockchain.Chain"
                    ),
                ),
                (
                    "currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="ethereum_money.EthereumToken",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="PaymentRoute",
            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"
                    ),
                ),
                (
                    "order",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="routes",
                        to="core.PaymentOrder",
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="Store",
            fields=[
                ("id", models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)),
                ("name", models.CharField(max_length=300)),
                ("url", models.URLField()),
                ("accepted_currencies", models.ManyToManyField(to="ethereum_money.EthereumToken")),
                (
                    "owner",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL
                    ),
                ),
            ],
        ),
        migrations.CreateModel(
            name="Transfer",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "amount",
                    hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                        decimal_places=18, max_digits=32
                    ),
                ),
                (
                    "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"
                    ),
                ),
                ("memo", models.TextField(blank=True, null=True)),
                ("identifier", models.CharField(blank=True, max_length=300, null=True)),
                (
                    "currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="ethereum_money.EthereumToken",
                    ),
                ),
                (
                    "sender",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transfers_sent",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="UserBalanceEntry",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "amount",
                    hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                        decimal_places=18, max_digits=32
                    ),
                ),
                (
                    "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"
                    ),
                ),
                (
                    "currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="ethereum_money.EthereumToken",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="balance_entries",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="UserReserve",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                (
                    "amount",
                    hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                        decimal_places=18, max_digits=32
                    ),
                ),
                (
                    "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"
                    ),
                ),
                (
                    "currency",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        to="ethereum_money.EthereumToken",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="reserves",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="HubSite",
            fields=[],
            options={"proxy": True, "indexes": [], "constraints": [],},
            bases=("sites.site",),
            managers=[("objects", django.contrib.sites.models.SiteManager()),],
        ),
        migrations.CreateModel(
            name="ExternalTransfer",
            fields=[
                (
                    "transfer_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.Transfer",
                    ),
                ),
                (
                    "recipient_address",
                    hub20.apps.blockchain.fields.EthereumAddressField(db_index=True),
                ),
            ],
            options={"abstract": False,},
            bases=("core.transfer",),
        ),
        migrations.CreateModel(
            name="InternalPayment",
            fields=[
                (
                    "payment_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.Payment",
                    ),
                ),
                ("memo", models.TextField(blank=True, null=True)),
            ],
            options={"abstract": False,},
            bases=("core.payment",),
        ),
        migrations.CreateModel(
            name="InternalPaymentRoute",
            fields=[
                (
                    "paymentroute_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.PaymentRoute",
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.paymentroute",),
        ),
        migrations.CreateModel(
            name="StoreRSAKeyPair",
            fields=[
                (
                    "id",
                    models.AutoField(
                        auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
                    ),
                ),
                ("public_key_pem", models.TextField()),
                ("private_key_pem", models.TextField()),
                (
                    "store",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="rsa",
                        to="core.Store",
                    ),
                ),
            ],
        ),
        migrations.AddField(
            model_name="payment",
            name="route",
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.PROTECT, to="core.PaymentRoute"
            ),
        ),
        migrations.CreateModel(
            name="BlockchainTransaction",
            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"
                    ),
                ),
                (
                    "transaction_hash",
                    hub20.apps.blockchain.fields.HexField(
                        db_index=True, max_length=64, unique=True
                    ),
                ),
                (
                    "transfer",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="chain_transaction",
                        to="core.Transfer",
                    ),
                ),
            ],
            options={"abstract": False,},
        ),
        migrations.CreateModel(
            name="UserTransferReserve",
            fields=[
                (
                    "userreserve_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.UserReserve",
                    ),
                ),
                (
                    "transfer",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="reserve",
                        to="core.Transfer",
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.userreserve",),
        ),
        migrations.CreateModel(
            name="TransferEvent",
            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"
                    ),
                ),
                (
                    "status",
                    model_utils.fields.StatusField(
                        choices=[
                            ("scheduled", "scheduled"),
                            ("failed", "failed"),
                            ("canceled", "canceled"),
                            ("executed", "executed"),
                            ("confirmed", "confirmed"),
                        ],
                        default="scheduled",
                        max_length=100,
                        no_check_for_status=True,
                        verbose_name="status",
                    ),
                ),
                (
                    "status_changed",
                    model_utils.fields.MonitorField(
                        default=django.utils.timezone.now,
                        monitor="status",
                        verbose_name="status changed",
                    ),
                ),
                (
                    "transfer",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="events",
                        to="core.Transfer",
                    ),
                ),
            ],
            options={"get_latest_by": "created", "unique_together": {("transfer", "status")},},
        ),
        migrations.CreateModel(
            name="RaidenTransaction",
            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"
                    ),
                ),
                ("identifier", models.PositiveIntegerField()),
                (
                    "channel",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="raiden.Channel"
                    ),
                ),
                (
                    "transfer",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="raiden_transaction",
                        to="core.Transfer",
                    ),
                ),
            ],
            options={"unique_together": {("channel", "identifier")},},
        ),
        migrations.CreateModel(
            name="RaidenPayment",
            fields=[
                (
                    "payment_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.Payment",
                    ),
                ),
                (
                    "payment",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE, to="raiden.Payment"
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.payment",),
        ),
        migrations.CreateModel(
            name="PaymentCredit",
            fields=[
                (
                    "userbalanceentry_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.UserBalanceEntry",
                    ),
                ),
                (
                    "payment",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="credit",
                        to="core.Payment",
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.userbalanceentry",),
        ),
        migrations.CreateModel(
            name="InternalTransfer",
            fields=[
                (
                    "transfer_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.Transfer",
                    ),
                ),
                (
                    "receiver",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="transfers_received",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.transfer",),
        ),
        migrations.CreateModel(
            name="Checkout",
            fields=[
                (
                    "paymentorder_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.PaymentOrder",
                    ),
                ),
                ("external_identifier", models.TextField()),
                ("requester_ip", models.GenericIPAddressField(null=True)),
                (
                    "store",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE, to="core.Store"
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.paymentorder",),
        ),
        migrations.CreateModel(
            name="BlockchainPaymentRoute",
            fields=[
                (
                    "paymentroute_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.PaymentRoute",
                    ),
                ),
                (
                    "payment_window",
                    django.contrib.postgres.fields.ranges.IntegerRangeField(
                        default=hub20.apps.core.models.payments.calculate_blockchain_payment_window
                    ),
                ),
                (
                    "account",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="payment_routes",
                        to=settings.ETHEREUM_ACCOUNT_MODEL,
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.paymentroute",),
        ),
        migrations.CreateModel(
            name="BlockchainPayment",
            fields=[
                (
                    "payment_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.Payment",
                    ),
                ),
                (
                    "transaction",
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE, to="blockchain.Transaction"
                    ),
                ),
            ],
            options={"abstract": False,},
            bases=("core.payment",),
        ),
        migrations.CreateModel(
            name="RaidenPaymentRoute",
            fields=[
                (
                    "paymentroute_ptr",
                    models.OneToOneField(
                        auto_created=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        parent_link=True,
                        primary_key=True,
                        serialize=False,
                        to="core.PaymentRoute",
                    ),
                ),
                (
                    "payment_window",
                    models.DurationField(
                        default=hub20.apps.core.models.payments.calculate_raiden_payment_window
                    ),
                ),
                (
                    "identifier",
                    models.BigIntegerField(
                        default=hub20.apps.core.models.payments.generate_payment_order_id,
                        unique=True,
                    ),
                ),
                (
                    "raiden",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="payment_routes",
                        to="raiden.Raiden",
                    ),
                ),
            ],
            options={"unique_together": {("raiden", "identifier")},},
            bases=("core.paymentroute",),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='SiteCustomization',
            fields=[
                ('site', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to='sites.site', verbose_name='site')),
                ('is_open_for_signup', models.BooleanField(default=True, verbose_name='is open for signup')),
                ('tagline', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, verbose_name='tagline')),
                ('tagline_fr', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_en', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_de', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_pt', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_es', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_ja', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_ar', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_ar_dz', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_zh_hans', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_br', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('description', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, verbose_name='description')),
                ('description_fr', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_en', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_de', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_pt', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_es', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_ja', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_ar', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_ar_dz', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_zh_hans', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_br', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
            ],
            options={
                'verbose_name': 'site customization',
                'verbose_name_plural': 'site customizations',
                'ordering': ['site'],
            },
        ),
        migrations.CreateModel(
            name='HistoricalSiteCustomization',
            fields=[
                ('is_open_for_signup', models.BooleanField(default=True, verbose_name='is open for signup')),
                ('tagline', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, verbose_name='tagline')),
                ('tagline_fr', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_en', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_de', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_pt', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_es', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_ja', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_ar', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_ar_dz', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_zh_hans', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('tagline_br', models.CharField(blank=True, default='A few words to describe this very website.', help_text='A few words to describe this very website.', max_length=255, null=True, verbose_name='tagline')),
                ('description', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, verbose_name='description')),
                ('description_fr', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_en', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_de', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_pt', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_es', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_ja', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_ar', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_ar_dz', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_zh_hans', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('description_br', models.TextField(blank=True, default='A short text to describe this very website.', help_text='A short text to describe this very website.', max_length=2048, null=True, verbose_name='description')),
                ('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, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='sites.site', verbose_name='site')),
            ],
            options={
                'verbose_name': 'historical site customization',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalSite',
            fields=[
                ('id', models.IntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('domain', models.CharField(db_index=True, max_length=100, validators=[django.contrib.sites.models._simple_domain_name_validator], verbose_name='domain name')),
                ('name', models.CharField(max_length=50, verbose_name='display name')),
                ('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)),
            ],
            options={
                'verbose_name': 'historical site',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
    ]
Beispiel #15
0
class RuleAnnotation(models.Model):
    name = models.CharField(max_length=128)
    value = models.TextField()
    rule = models.ForeignKey('Rule', on_delete=models.CASCADE)
Beispiel #16
0
class Rule(models.Model):
    objects = ObjectFilterManager()

    name = models.CharField(max_length=128,
                            unique=True,
                            validators=[validators.alphanumeric])
    clause = models.TextField(help_text='Prometheus query')
    duration = models.CharField(
        max_length=128,
        validators=[validators.duration],
        help_text="Duration field with postfix. Example 30s, 5m, 1d")
    enabled = models.BooleanField(default=True)
    parent = models.ForeignKey('Rule',
                               null=True,
                               related_name='overrides',
                               on_delete=models.SET_NULL)

    content_type = models.ForeignKey(
        ContentType,
        on_delete=models.CASCADE,
        limit_choices_to=(models.Q(app_label='sites', model='site')
                          | models.Q(app_label='promgen', model='project')
                          | models.Q(app_label='promgen', model='service')))
    object_id = models.PositiveIntegerField()
    content_object = GenericForeignKey('content_type', 'object_id')
    description = models.TextField(blank=True)

    class Meta:
        ordering = ['content_type', 'object_id', 'name']

    @cached_property
    def labels(self):
        return {obj.name: obj.value for obj in self.rulelabel_set.all()}

    def add_label(self, name, value):
        return RuleLabel.objects.get_or_create(rule=self,
                                               name=name,
                                               value=value)

    def add_annotation(self, name, value):
        return RuleAnnotation.objects.get_or_create(rule=self,
                                                    name=name,
                                                    value=value)

    @cached_property
    def annotations(self):
        _annotations = {
            obj.name: obj.value
            for obj in self.ruleannotation_set.all()
        }
        # Skip when pk is not set, such as when test rendering a rule
        if self.pk and 'rule' not in _annotations:
            _annotations['rule'] = resolve_domain('rule-edit', pk=self.pk)
        return _annotations

    def __str__(self):
        return '{} [{}]'.format(self.name, self.content_object.name)

    def get_absolute_url(self):
        return reverse('rule-edit', kwargs={'pk': self.pk})

    def set_object(self, content_type, object_id):
        self.content_type = ContentType.objects.get(model=content_type,
                                                    app_label='promgen')
        self.object_id = object_id

    def copy_to(self, content_type, object_id):
        '''
        Make a copy under a new service

        It's important that we set pk to None so a new object is created, but we
        also need to ensure the new name is unique by appending some unique data
        to the end of the name
        '''
        with transaction.atomic():
            content_type = ContentType.objects.get(model=content_type,
                                                   app_label='promgen')

            # First check to see if this rule is already overwritten
            for rule in Rule.objects.filter(parent_id=self.pk,
                                            content_type=content_type,
                                            object_id=object_id):
                return rule

            content_object = content_type.get_object_for_this_type(
                pk=object_id)

            orig_pk = self.pk
            self.pk = None
            self.parent_id = orig_pk
            self.name = '{}_{}'.format(self.name,
                                       slugify(content_object.name)).replace(
                                           '-', '_')
            self.content_type = content_type
            self.object_id = object_id
            self.enabled = False
            self.clause = self.clause.replace(
                macro.EXCLUSION_MACRO,
                '{}="{}",{}'.format(content_type.model, content_object.name,
                                    macro.EXCLUSION_MACRO))
            self.save()

            # Add a label to our new rule by default, to help ensure notifications
            # get routed to the notifier we expect
            self.add_label(content_type.model, content_object.name)

            for label in RuleLabel.objects.filter(rule_id=orig_pk):
                # Skip service labels from our previous rule
                if label.name in ['service', 'project']:
                    logger.debug('Skipping %s: %s', label.name, label.value)
                    continue
                logger.debug('Copying %s to %s', label, self)
                label.pk = None
                label.rule = self
                label.save()

            for annotation in RuleAnnotation.objects.filter(rule_id=orig_pk):
                logger.debug('Copying %s to %s', annotation, self)
                annotation.pk = None
                annotation.rule = self
                annotation.save()

        return self
Beispiel #17
0
class AlertLabel(models.Model):
    alert = models.ForeignKey('Alert', on_delete=models.CASCADE)
    name = models.CharField(max_length=128)
    value = models.TextField()
class Migration(migrations.Migration):

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
        ('content', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='UniversitySite',
            fields=[
                ('site_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='sites.Site')),
            ],
            options={
                'verbose_name': 'University Site',
            },
            bases=('sites.site', parler.models.TranslatableModelMixin,
                   models.Model),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.CreateModel(
            name='UniversitySiteTranslation',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('language_code',
                 models.CharField(db_index=True,
                                  max_length=15,
                                  verbose_name='Language')),
                ('description', models.TextField()),
                ('master',
                 parler.fields.TranslationsForeignKey(
                     editable=False,
                     null=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='translations',
                     to='content.UniversitySite')),
            ],
            options={
                'verbose_name': 'University Site Translation',
                'db_table': 'content_universitysite_translation',
                'db_tablespace': '',
                'managed': True,
                'default_permissions': (),
                'unique_together': {('language_code', 'master')},
            },
            bases=(parler.models.TranslatedFieldsModelMixin, models.Model),
        ),
    ]
Beispiel #19
0
class Migration(migrations.Migration):

    replaces = [('promgen', '0001_initial'), ('promgen', '0002_audit'),
                ('promgen', '0003_setting'),
                ('promgen', '0004_auto_20161019_0755'),
                ('promgen', '0005_sender'),
                ('promgen', '0006_auto_20161019_1214'),
                ('promgen', '0007_auto_20161020_0253'),
                ('promgen', '0008_auto_20161020_0528'),
                ('promgen', '0009_auto_20161021_0640'),
                ('promgen', '0010_auto_20161025_0034'),
                ('promgen', '0011_auto_20161025_0737'),
                ('promgen', '0012_auto_20161027_0306'),
                ('promgen', '0013_auto_20161027_0307'),
                ('promgen', '0014_stat'), ('promgen', '0015_delete_stat'),
                ('promgen', '0016_auto_20161121_0714'),
                ('promgen', '0017_auto_20161215_2352'),
                ('promgen', '0018_rule_enabled'), ('promgen', '0019_url'),
                ('promgen', '0020_auto_20161226_0337'),
                ('promgen', '0021_auto_20161228_0049'),
                ('promgen', '0022_auto_20170116_0824'),
                ('promgen', '0023_shard'),
                ('promgen', '0024_auto_20170220_0324'),
                ('promgen', '0025_shard_url'),
                ('promgen', '0026_auto_20170315_0344'),
                ('promgen', '0027_prometheus_server'),
                ('promgen', '0028_url_sort_fields'),
                ('promgen', '0029_auto_20170406_0236'),
                ('promgen', '0030_exporter_enabled'),
                ('promgen', '0031_sender_to_notification'),
                ('promgen', '0032_audit_diff'), ('promgen', '0033_diff_old'),
                ('promgen', '0034_auto_20170622_0518'),
                ('promgen', '0035_rule_parent'),
                ('promgen', '0036_auto_20170626_0231'),
                ('promgen', '0037_shard_proxy'),
                ('promgen', '0038_audit_user'),
                ('promgen', '0039_auto_20170725_0257'),
                ('promgen', '0040_default_farm'),
                ('promgen', '0041_sender_owner'),
                ('promgen', '0042_description_field'),
                ('promgen', '0043_rule_description'),
                ('promgen', '0044_common-rules')]

    initial = True

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
        ('contenttypes', '0002_remove_content_type_name'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Audit',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('body', models.TextField()),
                ('created', models.DateTimeField()),
                ('data', models.TextField(blank=True)),
                ('old', models.TextField(blank=True)),
                ('object_id', models.PositiveIntegerField(default=0)),
                ('content_type',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.ContentType')),
                ('user',
                 models.ForeignKey(
                     default=None,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Exporter',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('job', models.CharField(max_length=128)),
                ('port', models.IntegerField()),
                ('path', models.CharField(blank=True, max_length=128)),
                ('enabled', models.BooleanField(default=True)),
            ],
            options={
                'ordering': ['job', 'port'],
            },
        ),
        migrations.CreateModel(
            name='Farm',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('source', models.CharField(max_length=128)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Host',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('farm',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='promgen.Farm')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('description', models.TextField(blank=True)),
                ('farm',
                 models.ForeignKey(
                     blank=True,
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='promgen.Farm')),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='Prometheus',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('host', models.CharField(max_length=128)),
                ('port', models.IntegerField()),
            ],
            options={
                'verbose_name_plural': 'prometheis',
                'ordering': ['shard', 'host'],
            },
        ),
        migrations.CreateModel(
            name='Rule',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name',
                 models.CharField(
                     max_length=128,
                     unique=True,
                     validators=[
                         django.core.validators.RegexValidator(
                             '^[0-9a-zA-Z_]*$',
                             'Only alphanumeric characters are allowed.')
                     ])),
                ('clause', models.TextField(help_text='Prometheus query')),
                ('duration',
                 models.CharField(
                     help_text=
                     'Duration field with postfix. Example 30s, 5m, 1d',
                     max_length=128,
                     validators=[promgen.validators.prometheusduration])),
                ('enabled', models.BooleanField(default=True)),
                ('object_id', models.PositiveIntegerField()),
                ('description', models.TextField(blank=True)),
                ('content_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.ContentType')),
                ('parent',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     related_name='overrides',
                     to='promgen.Rule')),
            ],
            options={
                'ordering': ['content_type', 'object_id', 'name'],
            },
        ),
        migrations.CreateModel(
            name='RuleAnnotation',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('value', models.TextField()),
                ('rule',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='promgen.Rule')),
            ],
        ),
        migrations.CreateModel(
            name='RuleLabel',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128)),
                ('value', models.CharField(max_length=128)),
                ('rule',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='promgen.Rule')),
            ],
        ),
        migrations.CreateModel(
            name='Sender',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('sender', models.CharField(max_length=128)),
                ('value', models.CharField(max_length=128)),
                ('alias', models.CharField(blank=True, max_length=128)),
                ('object_id', models.PositiveIntegerField()),
                ('content_type',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='contenttypes.ContentType')),
                ('owner',
                 models.ForeignKey(null=True,
                                   on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Service',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('description', models.TextField(blank=True)),
            ],
            options={
                'ordering': ['shard', 'name'],
            },
        ),
        migrations.CreateModel(
            name='Shard',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('name', models.CharField(max_length=128, unique=True)),
                ('url', models.URLField(max_length=256)),
                ('proxy', models.BooleanField(default=False)),
            ],
            options={
                'ordering': ['name'],
            },
        ),
        migrations.CreateModel(
            name='URL',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('url', models.URLField(max_length=256)),
                ('project',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='promgen.Project')),
            ],
            options={
                'ordering': ['project__service', 'project', 'url'],
            },
        ),
        migrations.CreateModel(
            name='Site',
            fields=[],
            options={
                'indexes': [],
                'proxy': True,
            },
            bases=('sites.site', ),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.AddField(
            model_name='service',
            name='shard',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='promgen.Shard'),
        ),
        migrations.AddField(
            model_name='prometheus',
            name='shard',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='promgen.Shard'),
        ),
        migrations.AddField(
            model_name='project',
            name='service',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='promgen.Service'),
        ),
        migrations.AlterUniqueTogether(
            name='farm',
            unique_together=set([('name', 'source')]),
        ),
        migrations.AddField(
            model_name='exporter',
            name='project',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE,
                to='promgen.Project'),
        ),
        migrations.AlterUniqueTogether(
            name='prometheus',
            unique_together=set([('host', 'port')]),
        ),
        migrations.AlterUniqueTogether(
            name='host',
            unique_together=set([('name', 'farm')]),
        ),
        migrations.AlterUniqueTogether(
            name='exporter',
            unique_together=set([('job', 'port', 'project')]),
        ),
    ]
Beispiel #20
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
        ('pulse', '0005_auto_20180422_1602'),
    ]

    operations = [
        migrations.CreateModel(
            name='MenuItem',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('icon', models.SlugField(blank=True, choices=[('fa fa-home', 'Home'), ('fa fa-pencil-square-o', 'Posts'), ('fa fa-book', 'Notes'), ('fa fa-tags', 'Topics'), ('fa fa-code-fork', 'Channels'), ('fa fa-file-image-o', 'Media'), ('fa fa-cogs', 'Gears')], max_length=510)),
                ('title', models.CharField(default='Untitled', max_length=510)),
                ('description', models.CharField(blank=True, help_text='Optional subtitle', max_length=510)),
                ('slug', models.SlugField(blank=True, max_length=510)),
                ('url', models.CharField(blank=True, max_length=510)),
                ('weight', models.IntegerField(default=0)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('page', models.ForeignKey(blank=True, default=replica.pulse.models.DefaultEntry, null=True, on_delete=django.db.models.deletion.SET_DEFAULT, to='pulse.Entry')),
            ],
            options={
                'verbose_name': 'Menu Item',
                'verbose_name_plural': 'Menu Items',
                'db_table': 'r_MenuItem',
                'ordering': ('weight',),
            },
        ),
        migrations.CreateModel(
            name='MenuPosition',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('title', models.CharField(default='Untitled', max_length=510)),
                ('slug', models.SlugField(max_length=510)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Menu',
                'verbose_name_plural': 'Menus',
                'db_table': 'r_MenuPosition',
                'ordering': ('-title',),
            },
        ),
        migrations.CreateModel(
            name='Plugin',
            fields=[
                ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)),
                ('name', models.CharField(blank=True, max_length=510)),
                ('slug', models.SlugField(max_length=510)),
                ('author', models.CharField(blank=True, max_length=510)),
                ('is_enabled', models.BooleanField(choices=[(True, 'Enabled'), (False, 'Disabled')], default=True, help_text='Check to enable plugin')),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
            ],
            options={
                'verbose_name': 'Plugin',
                'verbose_name_plural': 'Plugins',
                'db_table': 'r_Plugin',
                'ordering': ('slug', 'date_updated'),
            },
        ),
        migrations.CreateModel(
            name='SiteSettings',
            fields=[
                ('site_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='sites.Site')),
                ('is_enabled', models.BooleanField(choices=[(True, 'Enabled'), (False, 'Disabled')], default=True, help_text='Is site enabled?')),
                ('password', models.CharField(blank=True, max_length=128)),
                ('secret_token', models.CharField(blank=True, max_length=12)),
                ('view_settings', models.TextField(default='{}')),
                ('author', models.CharField(blank=True, max_length=510)),
                ('description', models.TextField(blank=True, help_text='Site Description', null=True)),
                ('summary', models.TextField(blank=True, help_text='Summary')),
                ('summary_html', models.TextField(blank=True, editable=False)),
                ('date_created', models.DateTimeField(auto_now_add=True)),
                ('date_updated', models.DateTimeField(auto_now=True)),
                ('featured', models.ForeignKey(blank=True, help_text='Featured Image', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='featured', to='pulse.Media')),
                ('logo', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='logo', to='pulse.Media')),
            ],
            options={
                'verbose_name': 'Site Settings',
                'verbose_name_plural': 'Site Settings',
                'db_table': 'r_SiteSettings',
            },
            bases=('sites.site',),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.AddField(
            model_name='menuitem',
            name='position',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='cms.MenuPosition'),
        ),
    ]
Beispiel #21
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [("auth", "0009_alter_user_last_name_max_length")]

    operations = [
        migrations.CreateModel(
            name="User",
            fields=[
                ("password",
                 models.CharField(max_length=128, verbose_name="password")),
                (
                    "last_login",
                    models.DateTimeField(blank=True,
                                         null=True,
                                         verbose_name="last login"),
                ),
                (
                    "is_superuser",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "Designates that this user has all permissions without explicitly assigning them.",
                        verbose_name="superuser status",
                    ),
                ),
                (
                    "username",
                    models.CharField(
                        error_messages={
                            "unique":
                            "A user with that username already exists."
                        },
                        help_text=
                        "Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.",
                        max_length=150,
                        unique=True,
                        validators=[
                            django.contrib.auth.validators.
                            UnicodeUsernameValidator()
                        ],
                        verbose_name="username",
                    ),
                ),
                (
                    "first_name",
                    models.CharField(blank=True,
                                     max_length=30,
                                     verbose_name="first name"),
                ),
                (
                    "last_name",
                    models.CharField(blank=True,
                                     max_length=150,
                                     verbose_name="last name"),
                ),
                (
                    "email",
                    models.EmailField(blank=True,
                                      max_length=254,
                                      verbose_name="email address"),
                ),
                (
                    "is_staff",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "Designates whether the user can log into this admin site.",
                        verbose_name="staff status",
                    ),
                ),
                (
                    "is_active",
                    models.BooleanField(
                        default=True,
                        help_text=
                        "Designates whether this user should be treated as active. Unselect this instead of deleting accounts.",
                        verbose_name="active",
                    ),
                ),
                (
                    "date_joined",
                    models.DateTimeField(default=django.utils.timezone.now,
                                         verbose_name="date joined"),
                ),
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "groups",
                    models.ManyToManyField(
                        blank=True,
                        help_text=
                        "The groups this user belongs to. A user will get all permissions granted to each of their groups.",
                        related_name="user_set",
                        related_query_name="user",
                        to="auth.Group",
                        verbose_name="groups",
                    ),
                ),
                (
                    "user_permissions",
                    models.ManyToManyField(
                        blank=True,
                        help_text="Specific permissions for this user.",
                        related_name="user_set",
                        related_query_name="user",
                        to="auth.Permission",
                        verbose_name="user permissions",
                    ),
                ),
            ],
            options={
                "verbose_name": "user",
                "verbose_name_plural": "users",
                "db_table": "user",
            },
            managers=[("objects", marsha.core.managers.UserManager())],
        ),
        migrations.CreateModel(
            name="AudioTrack",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "language",
                    models.CharField(
                        choices=[("en", "english"), ("fr", "french")],
                        help_text="language of this track",
                        max_length=5,
                        verbose_name="track language",
                    ),
                ),
                (
                    "uploaded_on",
                    models.DateTimeField(
                        blank=True,
                        help_text=
                        "datetime at which the active version of the video was uploaded.",
                        null=True,
                        verbose_name="uploaded on",
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        choices=[
                            ("pending", "pending"),
                            ("processing", "processing"),
                            ("error", "error"),
                            ("ready", "ready"),
                        ],
                        default="pending",
                        help_text=
                        "state of the upload and transcoding pipeline in AWS.",
                        max_length=20,
                        verbose_name="state",
                    ),
                ),
            ],
            options={
                "verbose_name": "audio track",
                "verbose_name_plural": "audio tracks",
                "db_table": "audio_track",
            },
        ),
        migrations.CreateModel(
            name="ConsumerSite",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="name of the consumer site",
                        max_length=50,
                        verbose_name="display name",
                    ),
                ),
                (
                    "domain",
                    models.CharField(
                        help_text="base domain allowed for consumer site.",
                        max_length=100,
                        validators=[
                            django.contrib.sites.models.
                            _simple_domain_name_validator
                        ],
                        verbose_name="domain name",
                    ),
                ),
            ],
            options={
                "verbose_name": "consumer site",
                "verbose_name_plural": "consumer sites",
                "db_table": "consumer_site",
            },
        ),
        migrations.CreateModel(
            name="ConsumerSiteAccess",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "role",
                    models.CharField(
                        choices=[
                            ("administrator", "administrator"),
                            ("instructor", "instructor"),
                            ("student", "student"),
                        ],
                        default="administrator",
                        help_text=
                        "role granted to the user on the consumer site",
                        max_length=20,
                        verbose_name="role",
                    ),
                ),
                (
                    "consumer_site",
                    models.ForeignKey(
                        help_text="consumer site to which the user has access",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="user_accesses",
                        to="core.ConsumerSite",
                        verbose_name="site",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="user with access to the consumer site",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="consumersite_accesses",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="user",
                    ),
                ),
            ],
            options={
                "verbose_name": "consumer site access",
                "verbose_name_plural": "consumer site accesses",
                "db_table": "consumersite_access",
            },
        ),
        migrations.CreateModel(
            name="ConsumerSiteOrganization",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "consumer_site",
                    models.ForeignKey(
                        help_text="consumer site having this organization",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="organizations_links",
                        to="core.ConsumerSite",
                        verbose_name="site",
                    ),
                ),
            ],
            options={
                "verbose_name": "organization in consumer site",
                "verbose_name_plural": "organizations in consumer sites",
                "db_table": "consumersite_organization",
            },
        ),
        migrations.CreateModel(
            name="LTIPassport",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "oauth_consumer_key",
                    models.CharField(
                        editable=False,
                        help_text=
                        "oauth consumer key to authenticate an LTI consumer on the LTI provider",
                        max_length=255,
                        unique=True,
                        verbose_name="oauth consumer key",
                    ),
                ),
                (
                    "shared_secret",
                    models.CharField(
                        editable=False,
                        help_text="LTI Shared secret",
                        max_length=255,
                        verbose_name="shared secret",
                    ),
                ),
                (
                    "is_enabled",
                    models.BooleanField(
                        default=True,
                        help_text="whether the passport is enabled",
                        verbose_name="is enabled",
                    ),
                ),
                (
                    "consumer_site",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="lti_passport_scopes",
                        to="core.ConsumerSite",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        editable=False,
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="lti_passports",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
            ],
            options={
                "verbose_name": "LTI passport",
                "verbose_name_plural": "LTI passports",
                "db_table": "lti_passport",
            },
        ),
        migrations.CreateModel(
            name="Organization",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "name",
                    models.CharField(
                        help_text="name of the organization",
                        max_length=255,
                        verbose_name="name",
                    ),
                ),
                (
                    "consumer_sites",
                    models.ManyToManyField(
                        help_text=
                        "consumer sites on which this organization is present",
                        related_name="organizations",
                        through="core.ConsumerSiteOrganization",
                        to="core.ConsumerSite",
                        verbose_name="consumer sites",
                    ),
                ),
            ],
            options={
                "verbose_name": "organization",
                "verbose_name_plural": "organizations",
                "db_table": "organization",
            },
        ),
        migrations.CreateModel(
            name="OrganizationAccess",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "role",
                    models.CharField(
                        choices=[
                            ("administrator", "administrator"),
                            ("instructor", "instructor"),
                            ("student", "student"),
                        ],
                        default="instructor",
                        help_text=
                        "role granted to the user on the consumer site",
                        max_length=20,
                        verbose_name="role",
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        help_text="organization to which the user has access",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="user_accesses",
                        to="core.Organization",
                        verbose_name="organization",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="user who has access to the organization",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="organization_accesses",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="user",
                    ),
                ),
            ],
            options={
                "verbose_name": "organization access",
                "verbose_name_plural": "organization accesses",
                "db_table": "organization_access",
            },
        ),
        migrations.CreateModel(
            name="Playlist",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "title",
                    models.CharField(
                        help_text="title of the playlist",
                        max_length=255,
                        verbose_name="title",
                    ),
                ),
                (
                    "lti_id",
                    models.CharField(
                        help_text=
                        "ID for synchronization with an external LTI tool",
                        max_length=255,
                        verbose_name="lti id",
                    ),
                ),
                (
                    "is_public",
                    models.BooleanField(
                        default=False,
                        help_text=
                        "if this playlist can be viewed without any access control",
                        verbose_name="is public",
                    ),
                ),
                ("is_portable_to_playlist", models.BooleanField(default=True)),
                ("is_portable_to_consumer_site",
                 models.BooleanField(default=False)),
                (
                    "consumer_site",
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="playlists",
                        to="core.ConsumerSite",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="created_playlists",
                        to=settings.AUTH_USER_MODEL,
                    ),
                ),
                (
                    "duplicated_from",
                    models.ForeignKey(
                        blank=True,
                        help_text=
                        "original playlist this one was duplicated from",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="duplicates",
                        to="core.Playlist",
                        verbose_name="duplicate from",
                    ),
                ),
                (
                    "organization",
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="playlists",
                        to="core.Organization",
                    ),
                ),
            ],
            options={
                "verbose_name": "playlist",
                "verbose_name_plural": "playlists",
                "db_table": "playlist",
            },
        ),
        migrations.CreateModel(
            name="PlaylistAccess",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "role",
                    models.CharField(
                        choices=[
                            ("administrator", "administrator"),
                            ("instructor", "instructor"),
                            ("student", "student"),
                        ],
                        default="instructor",
                        help_text=
                        "role granted to the user on the consumer site",
                        max_length=20,
                        verbose_name="role",
                    ),
                ),
                (
                    "playlist",
                    models.ForeignKey(
                        help_text="playlist to which the user has access",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="user_accesses",
                        to="core.Playlist",
                        verbose_name="playlist",
                    ),
                ),
                (
                    "user",
                    models.ForeignKey(
                        help_text="user who has access to the playlist",
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="playlist_accesses",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="user",
                    ),
                ),
            ],
            options={
                "verbose_name": "playlist access",
                "verbose_name_plural": "playlist accesses",
                "db_table": "playlist_access",
            },
        ),
        migrations.CreateModel(
            name="SignTrack",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "language",
                    models.CharField(
                        choices=[("en", "english"), ("fr", "french")],
                        help_text="language of this track",
                        max_length=5,
                        verbose_name="track language",
                    ),
                ),
                (
                    "uploaded_on",
                    models.DateTimeField(
                        blank=True,
                        help_text=
                        "datetime at which the active version of the video was uploaded.",
                        null=True,
                        verbose_name="uploaded on",
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        choices=[
                            ("pending", "pending"),
                            ("processing", "processing"),
                            ("error", "error"),
                            ("ready", "ready"),
                        ],
                        default="pending",
                        help_text=
                        "state of the upload and transcoding pipeline in AWS.",
                        max_length=20,
                        verbose_name="state",
                    ),
                ),
            ],
            options={
                "verbose_name": "signs language track",
                "verbose_name_plural": "signs language tracks",
                "db_table": "sign_track",
            },
        ),
        migrations.CreateModel(
            name="TimedTextTrack",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "language",
                    models.CharField(
                        choices=[("en", "english"), ("fr", "french")],
                        help_text="language of this track",
                        max_length=5,
                        verbose_name="track language",
                    ),
                ),
                (
                    "uploaded_on",
                    models.DateTimeField(
                        blank=True,
                        help_text=
                        "datetime at which the active version of the video was uploaded.",
                        null=True,
                        verbose_name="uploaded on",
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        choices=[
                            ("pending", "pending"),
                            ("processing", "processing"),
                            ("error", "error"),
                            ("ready", "ready"),
                        ],
                        default="pending",
                        help_text=
                        "state of the upload and transcoding pipeline in AWS.",
                        max_length=20,
                        verbose_name="state",
                    ),
                ),
                (
                    "mode",
                    models.CharField(
                        choices=[
                            ("st", "Subtitle"),
                            ("ts", "Transcript"),
                            ("cc", "Closed captioning"),
                        ],
                        default="st",
                        help_text=
                        "Activate a special mode for this timed text track: simple subtitles, closed captioning (for deaf or hard of hearing viewers) or transcription (complete text below aside of the player).",
                        max_length=2,
                        verbose_name="mode",
                    ),
                ),
            ],
            options={
                "verbose_name": "timed text track",
                "verbose_name_plural": "timed text tracks",
                "db_table": "timed_text_track",
            },
        ),
        migrations.CreateModel(
            name="Video",
            fields=[
                ("deleted", models.DateTimeField(editable=False, null=True)),
                (
                    "id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text="primary key for the record as UUID",
                        primary_key=True,
                        serialize=False,
                        verbose_name="id",
                    ),
                ),
                (
                    "created_on",
                    models.DateTimeField(
                        auto_now_add=True,
                        help_text="date and time at which a record was created",
                        verbose_name="created on",
                    ),
                ),
                (
                    "updated_on",
                    models.DateTimeField(
                        auto_now=True,
                        help_text=
                        "date and time at which a record was last updated",
                        verbose_name="updated on",
                    ),
                ),
                (
                    "title",
                    models.CharField(
                        help_text="title of the video",
                        max_length=255,
                        verbose_name="title",
                    ),
                ),
                (
                    "description",
                    models.TextField(
                        blank=True,
                        help_text="description of the video",
                        null=True,
                        verbose_name="description",
                    ),
                ),
                (
                    "resource_id",
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        help_text=
                        "UUID to identify the resource in the backend",
                        verbose_name="Resource UUID",
                    ),
                ),
                (
                    "lti_id",
                    models.CharField(
                        help_text=
                        "ID for synchronization with an external LTI tool",
                        max_length=255,
                        verbose_name="lti id",
                    ),
                ),
                (
                    "position",
                    models.PositiveIntegerField(
                        default=0,
                        help_text="position of this video in the playlist",
                        verbose_name="position",
                    ),
                ),
                (
                    "uploaded_on",
                    models.DateTimeField(
                        blank=True,
                        help_text=
                        "datetime at which the active version of the video was uploaded.",
                        null=True,
                        verbose_name="uploaded on",
                    ),
                ),
                (
                    "state",
                    models.CharField(
                        choices=[
                            ("pending", "pending"),
                            ("processing", "processing"),
                            ("error", "error"),
                            ("ready", "ready"),
                        ],
                        default="pending",
                        help_text=
                        "state of the upload and transcoding pipeline in AWS.",
                        max_length=20,
                        verbose_name="state",
                    ),
                ),
                (
                    "created_by",
                    models.ForeignKey(
                        blank=True,
                        help_text="author of the video",
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name="created_videos",
                        to=settings.AUTH_USER_MODEL,
                        verbose_name="author",
                    ),
                ),
                (
                    "duplicated_from",
                    models.ForeignKey(
                        blank=True,
                        help_text="original video this one was duplicated from",
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        related_name="duplicates",
                        to="core.Video",
                        verbose_name="duplicate from",
                    ),
                ),
                (
                    "playlist",
                    models.ForeignKey(
                        help_text="playlist to which this video belongs",
                        on_delete=django.db.models.deletion.PROTECT,
                        related_name="videos",
                        to="core.Playlist",
                        verbose_name="playlist",
                    ),
                ),
            ],
            options={
                "verbose_name": "video",
                "verbose_name_plural": "videos",
                "db_table": "video",
                "ordering": ["position", "id"],
            },
        ),
        migrations.AddField(
            model_name="timedtexttrack",
            name="video",
            field=models.ForeignKey(
                help_text="video for which this track is",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="timedtexttracks",
                to="core.Video",
                verbose_name="video",
            ),
        ),
        migrations.AddField(
            model_name="signtrack",
            name="video",
            field=models.ForeignKey(
                help_text="video for which this track is",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="signtracks",
                to="core.Video",
                verbose_name="video",
            ),
        ),
        migrations.AddField(
            model_name="playlist",
            name="users",
            field=models.ManyToManyField(
                help_text="users who have been granted access to this playlist",
                related_name="playlists",
                through="core.PlaylistAccess",
                to=settings.AUTH_USER_MODEL,
                verbose_name="users",
            ),
        ),
        migrations.AddField(
            model_name="organization",
            name="users",
            field=models.ManyToManyField(
                help_text=
                "users who have been granted access to this organization",
                through="core.OrganizationAccess",
                to=settings.AUTH_USER_MODEL,
                verbose_name="users",
            ),
        ),
        migrations.AddField(
            model_name="ltipassport",
            name="playlist",
            field=models.ForeignKey(
                blank=True,
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                related_name="lti_passport_scopes",
                to="core.Playlist",
            ),
        ),
        migrations.AddField(
            model_name="consumersiteorganization",
            name="organization",
            field=models.ForeignKey(
                help_text="organization in this consumer site",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="sites_links",
                to="core.Organization",
                verbose_name="organization",
            ),
        ),
        migrations.AddField(
            model_name="consumersite",
            name="users",
            field=models.ManyToManyField(
                help_text=
                "users who have been granted access to this consumer site",
                through="core.ConsumerSiteAccess",
                to=settings.AUTH_USER_MODEL,
                verbose_name="users",
            ),
        ),
        migrations.AddField(
            model_name="audiotrack",
            name="video",
            field=models.ForeignKey(
                help_text="video for which this track is",
                on_delete=django.db.models.deletion.CASCADE,
                related_name="audiotracks",
                to="core.Video",
                verbose_name="video",
            ),
        ),
        migrations.AddIndex(
            model_name="timedtexttrack",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["video", "language", "mode"],
                name="timed_text__video_i_1425f7_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="signtrack",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["video", "language"],
                name="sign_track_video_i_8ae92b_idx"),
        ),
        migrations.AddIndex(
            model_name="playlistaccess",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["user", "playlist"],
                name="playlist_ac_user_id_c7df1b_idx"),
        ),
        migrations.AddIndex(
            model_name="organizationaccess",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["user", "organization"],
                name="organizatio_user_id_d0a5d6_idx"),
        ),
        migrations.AddIndex(
            model_name="consumersiteorganization",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["consumer_site", "organization"],
                name="consumersit_consume_89f4d1_idx",
            ),
        ),
        migrations.AddIndex(
            model_name="consumersiteaccess",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["user", "consumer_site"],
                name="consumersit_user_id_f9d219_idx"),
        ),
        migrations.AddIndex(
            model_name="audiotrack",
            index=marsha.core.models.base.NonDeletedUniqueIndex(
                fields=["video", "language"],
                name="audio_track_video_i_fe6276_idx"),
        ),
    ]
Beispiel #22
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('blockchain', '0001_initial'),
        ('ethereum_money', '0001_initial'),
        ('raiden', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('sites', '0002_alter_domain_unique'),
    ]

    operations = [
        migrations.CreateModel(
            name='PaymentOrder',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('amount',
                 hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                     decimal_places=18, max_digits=32)),
                ('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')),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='ethereum_money.EthereumToken')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Store',
            fields=[
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('name', models.CharField(max_length=300)),
                ('url', models.URLField()),
                ('accepted_currencies',
                 models.ManyToManyField(to='ethereum_money.EthereumToken')),
                ('owner',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Transfer',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('amount',
                 hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                     decimal_places=18, max_digits=32)),
                ('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')),
                ('memo', models.TextField(blank=True, null=True)),
                ('identifier',
                 models.CharField(blank=True, max_length=300, null=True)),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='ethereum_money.EthereumToken')),
                ('sender',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='transfers_sent',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserReserve',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('amount',
                 hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                     decimal_places=18, max_digits=32)),
                ('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')),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='ethereum_money.EthereumToken')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='reserves',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='HubSite',
            fields=[],
            options={
                'proxy': True,
                'indexes': [],
                'constraints': [],
            },
            bases=('sites.site', ),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.CreateModel(
            name='ExternalTransfer',
            fields=[
                ('transfer_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='core.Transfer')),
                ('recipient_address',
                 hub20.apps.blockchain.fields.EthereumAddressField(
                     db_index=True)),
            ],
            options={
                'abstract': False,
            },
            bases=('core.transfer', ),
        ),
        migrations.CreateModel(
            name='Wallet',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('account',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='ethereum_money.EthereumAccount')),
            ],
        ),
        migrations.CreateModel(
            name='UserBalanceEntry',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('amount',
                 hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                     decimal_places=18, max_digits=32)),
                ('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')),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='ethereum_money.EthereumToken')),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='balance_entries',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='StoreRSAKeyPair',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('public_key_pem', models.TextField()),
                ('private_key_pem', models.TextField()),
                ('store',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='rsa',
                     to='core.Store')),
            ],
        ),
        migrations.CreateModel(
            name='PaymentOrderMethod',
            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')),
                ('expiration_time', models.DateTimeField()),
                ('identifier',
                 models.BigIntegerField(default=hub20.apps.core.models.
                                        payments.generate_payment_order_id,
                                        unique=True)),
                ('order',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='payment_method',
                     to='core.PaymentOrder')),
                ('raiden',
                 models.ForeignKey(
                     null=True,
                     on_delete=django.db.models.deletion.SET_NULL,
                     to='raiden.Raiden')),
                ('wallet',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='core.Wallet')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Payment',
            fields=[
                ('amount',
                 hub20.apps.ethereum_money.models.EthereumTokenAmountField(
                     decimal_places=18, max_digits=32)),
                ('created',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='created')),
                ('modified',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modified')),
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('currency',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='ethereum_money.EthereumToken')),
                ('order',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to='core.PaymentOrder')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Checkout',
            fields=[
                ('created',
                 model_utils.fields.AutoCreatedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='created')),
                ('modified',
                 model_utils.fields.AutoLastModifiedField(
                     default=django.utils.timezone.now,
                     editable=False,
                     verbose_name='modified')),
                ('id',
                 models.UUIDField(default=uuid.uuid4,
                                  primary_key=True,
                                  serialize=False)),
                ('external_identifier', models.TextField()),
                ('requester_ip', models.GenericIPAddressField(null=True)),
                ('payment_order',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='core.PaymentOrder')),
                ('store',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='core.Store')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='BlockchainTransaction',
            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')),
                ('transaction_hash',
                 hub20.apps.blockchain.fields.HexField(db_index=True,
                                                       max_length=64,
                                                       unique=True)),
                ('transfer',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='chain_transaction',
                     to='core.Transfer')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='UserTransferReserve',
            fields=[
                ('userreserve_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='core.UserReserve')),
                ('transfer',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='reserve',
                     to='core.Transfer')),
            ],
            options={
                'abstract': False,
            },
            bases=('core.userreserve', ),
        ),
        migrations.CreateModel(
            name='TransferEvent',
            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')),
                ('status',
                 model_utils.fields.StatusField(choices=[
                     ('scheduled', 'scheduled'), ('failed', 'failed'),
                     ('canceled', 'canceled'), ('executed', 'executed'),
                     ('confirmed', 'confirmed')
                 ],
                                                default='scheduled',
                                                max_length=100,
                                                no_check_for_status=True,
                                                verbose_name='status')),
                ('status_changed',
                 model_utils.fields.MonitorField(
                     default=django.utils.timezone.now,
                     monitor='status',
                     verbose_name='status changed')),
                ('transfer',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='events',
                                   to='core.Transfer')),
            ],
            options={
                'get_latest_by': 'created',
                'unique_together': {('transfer', 'status')},
            },
        ),
        migrations.CreateModel(
            name='RaidenTransaction',
            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')),
                ('identifier', models.PositiveIntegerField()),
                ('channel',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to='raiden.Channel')),
                ('transfer',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     related_name='raiden_transaction',
                     to='core.Transfer')),
            ],
            options={
                'unique_together': {('channel', 'identifier')},
            },
        ),
        migrations.CreateModel(
            name='RaidenPayment',
            fields=[
                ('payment_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='core.Payment')),
                ('payment',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.PROTECT,
                     to='raiden.Payment')),
            ],
            options={
                'abstract': False,
            },
            bases=('core.payment', ),
        ),
        migrations.CreateModel(
            name='PaymentOrderEvent',
            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')),
                ('status',
                 model_utils.fields.StatusField(choices=[
                     ('requested', 'requested'), ('partial', 'partial'),
                     ('received', 'received'), ('confirmed', 'confirmed'),
                     ('expired', 'expired'), ('canceled', 'canceled'),
                     ('voided', 'voided')
                 ],
                                                default='requested',
                                                max_length=100,
                                                no_check_for_status=True,
                                                verbose_name='status')),
                ('status_changed',
                 model_utils.fields.MonitorField(
                     default=django.utils.timezone.now,
                     monitor='status',
                     verbose_name='status changed')),
                ('order',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='events',
                                   to='core.PaymentOrder')),
            ],
            options={
                'get_latest_by': 'created',
                'unique_together': {('order', 'status')},
            },
        ),
        migrations.CreateModel(
            name='InternalTransfer',
            fields=[
                ('transfer_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='core.Transfer')),
                ('receiver',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   related_name='transfers_received',
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
            bases=('core.transfer', ),
        ),
        migrations.CreateModel(
            name='InternalPayment',
            fields=[
                ('payment_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='core.Payment')),
                ('memo', models.TextField(blank=True, null=True)),
                ('user',
                 models.ForeignKey(on_delete=django.db.models.deletion.PROTECT,
                                   to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'abstract': False,
            },
            bases=('core.payment', ),
        ),
        migrations.CreateModel(
            name='BlockchainPayment',
            fields=[
                ('payment_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='core.Payment')),
                ('transaction',
                 models.OneToOneField(
                     on_delete=django.db.models.deletion.CASCADE,
                     to='blockchain.Transaction')),
            ],
            options={
                'abstract': False,
            },
            bases=('core.payment', ),
        ),
    ]
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sites', '0002_alter_domain_unique'),
        ('django_simple_file_handler', '0006_auto_20190429_1949'),
    ]

    operations = [
        migrations.CreateModel(
            name='BulkEmail',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last updated')),
                ('headline', models.CharField(max_length=254)),
                ('body_text', ckeditor.fields.RichTextField()),
                ('publication_date',
                 models.DateField(default=django.utils.timezone.localdate)),
                ('deletion_date',
                 models.DateField(blank=True,
                                  default=django_simple_bulk_emailer.models.
                                  get_deletion_date,
                                  null=True)),
                ('published', models.BooleanField(default=False)),
                ('is_updated',
                 models.BooleanField(default=False,
                                     verbose_name='has been updated')),
                ('sendable', models.BooleanField(default=False)),
                ('sending', models.BooleanField(default=False)),
                ('sent', models.BooleanField(default=False)),
                ('send_history', models.TextField(blank=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='EmailTracker',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last updated')),
                ('subject', models.CharField(max_length=254)),
                ('subscription_name', models.CharField(max_length=254)),
                ('send_complete',
                 models.DateTimeField(default=django.utils.timezone.now)),
                ('number_sent', models.PositiveIntegerField(default=0)),
                ('json_data', models.TextField(blank=True)),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='SiteProfile',
            fields=[
                ('site_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='sites.Site')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last updated')),
                ('protocol',
                 models.CharField(default='https://', max_length=254)),
            ],
            options={
                'abstract': False,
            },
            bases=('sites.site', models.Model),
            managers=[
                ('objects', django.contrib.sites.models.SiteManager()),
            ],
        ),
        migrations.CreateModel(
            name='Subscription',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last updated')),
                ('list_name', models.CharField(max_length=254)),
                ('descriptive_text',
                 ckeditor.fields.RichTextField(
                     blank=True,
                     verbose_name='descriptive text (if using page views)')),
                ('list_slug', models.CharField(blank=True, max_length=254)),
                ('publicly_visible', models.BooleanField(default=False)),
                ('use_pages',
                 models.BooleanField(default=True,
                                     verbose_name='use page view')),
                ('email_directory',
                 models.CharField(
                     default='django_simple_bulk_emailer/subscription/emails',
                     max_length=254,
                     verbose_name='email template directory')),
                ('page_directory',
                 models.CharField(
                     default='django_simple_bulk_emailer/subscription/pages',
                     max_length=254,
                     verbose_name='page template directory')),
                ('associated_model',
                 models.CharField(
                     default='django_simple_bulk_emailer.models.BulkEmail',
                     max_length=254)),
                ('mc_sync',
                 models.BooleanField(default=False,
                                     verbose_name='MailChimp sync')),
                ('mc_user',
                 models.CharField(default='username',
                                  max_length=254,
                                  verbose_name='MailChimp username')),
                ('mc_api',
                 models.CharField(default='API_key',
                                  max_length=254,
                                  verbose_name='MailChimp API key')),
                ('mc_list',
                 models.CharField(default='list_ID',
                                  max_length=254,
                                  verbose_name='MailChimp audience ID')),
                ('sort_order',
                 models.PositiveIntegerField(default=0, verbose_name='order')),
            ],
            options={
                'ordering': ['sort_order'],
            },
        ),
        migrations.CreateModel(
            name='Subscriber',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last updated')),
                ('subscriber_key', models.CharField(max_length=254)),
                ('first_name',
                 models.CharField(default='Anonymous', max_length=254)),
                ('last_name',
                 models.CharField(default='Subscriber', max_length=254)),
                ('subscriber_email',
                 models.EmailField(max_length=254,
                                   unique=True,
                                   verbose_name='email address')),
                ('mc_email',
                 models.EmailField(blank=True,
                                   max_length=254,
                                   verbose_name='MailChimp email address')),
                ('mc_synced', models.BooleanField(default=False)),
                ('subscriptions',
                 models.ManyToManyField(
                     blank=True,
                     to='django_simple_bulk_emailer.Subscription')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='MonthlyStat',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('created', models.DateTimeField(auto_now_add=True)),
                ('updated',
                 models.DateTimeField(auto_now=True,
                                      verbose_name='last updated')),
                ('year_int', models.PositiveIntegerField()),
                ('month_int', models.PositiveIntegerField()),
                ('stat_data', models.TextField(blank=True)),
                ('current_trackers',
                 models.ManyToManyField(
                     related_name='current',
                     to='django_simple_bulk_emailer.EmailTracker')),
                ('older_trackers',
                 models.ManyToManyField(
                     related_name='older',
                     to='django_simple_bulk_emailer.EmailTracker')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='EmailImage',
            fields=[
                ('processedimage_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='django_simple_file_handler.ProcessedImage')),
                ('description',
                 models.CharField(default='Image',
                                  max_length=254,
                                  verbose_name='screen reader description')),
                ('caption',
                 models.TextField(blank=True,
                                  verbose_name='image caption (optional)')),
                ('image_width', models.PositiveIntegerField()),
                ('bulk_email',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='emailimage',
                                   to='django_simple_bulk_emailer.BulkEmail')),
            ],
            options={
                'verbose_name': 'image (optional)',
                'verbose_name_plural': 'image (optional)',
            },
            bases=('django_simple_file_handler.processedimage', ),
        ),
        migrations.CreateModel(
            name='EmailDocument',
            fields=[
                ('temporarydocument_ptr',
                 models.OneToOneField(
                     auto_created=True,
                     on_delete=django.db.models.deletion.CASCADE,
                     parent_link=True,
                     primary_key=True,
                     serialize=False,
                     to='django_simple_file_handler.TemporaryDocument')),
                ('sort_order',
                 models.PositiveIntegerField(default=0, verbose_name='order')),
                ('bulk_email',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   related_name='documents',
                                   to='django_simple_bulk_emailer.BulkEmail')),
            ],
            options={
                'verbose_name': 'document',
                'ordering': ['sort_order'],
            },
            bases=('django_simple_file_handler.temporarydocument', ),
        ),
        migrations.AddField(
            model_name='bulkemail',
            name='subscription_list',
            field=models.ForeignKey(
                null=True,
                on_delete=django.db.models.deletion.SET_NULL,
                to='django_simple_bulk_emailer.Subscription'),
        ),
    ]
Beispiel #24
0
class AlertError(models.Model):
    alert = models.ForeignKey(Alert, on_delete=models.CASCADE)
    created = models.DateTimeField(default=timezone.now)
    message = models.TextField()