예제 #1
0
 class Meta(AbstractOrganizationConfigSettings.Meta):
     abstract = False
     swappable = swapper.swappable_setting('config',
                                           'OrganizationConfigSettings')
예제 #2
0
 class Meta(AbstractDeviceGroup.Meta):
     abstract = False
     swappable = swapper.swappable_setting('config', 'DeviceGroup')
예제 #3
0
 class Meta(AbstractTemplate.Meta):
     abstract = False
     swappable = swapper.swappable_setting('config', 'Template')
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        swapper.dependency(
            *split(settings.AUTH_USER_MODEL), version='0004_default_groups'
        ),
        ('contenttypes', '0002_remove_content_type_name'),
        swapper.dependency('openwisp_notifications', 'Notifications'),
    ]

    operations = [
        migrations.CreateModel(
            name='Metric',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    'created',
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name='created',
                    ),
                ),
                (
                    'modified',
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name='modified',
                    ),
                ),
                ('name', models.CharField(max_length=64)),
                (
                    'configuration',
                    models.CharField(
                        choices=METRIC_CONFIGURATION_CHOICES, max_length=16, null=True
                    ),
                ),
                (
                    'key',
                    models.SlugField(
                        blank=True,
                        help_text='leave blank to determine automatically',
                        max_length=64,
                    ),
                ),
                ('field_name', models.CharField(default='value', max_length=16)),
                (
                    'object_id',
                    models.CharField(blank=True, db_index=True, max_length=36),
                ),
                (
                    'content_type',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to='contenttypes.contenttype',
                    ),
                ),
                (
                    'is_healthy',
                    models.BooleanField(
                        blank=True, db_index=True, default=None, null=True
                    ),
                ),
            ],
            options={
                'abstract': False,
                'swappable': swapper.swappable_setting('monitoring', 'Metric'),
                'unique_together': {('key', 'field_name', 'content_type', 'object_id')},
            },
        ),
        migrations.CreateModel(
            name='Chart',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    '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',
                    ),
                ),
                (
                    'configuration',
                    models.CharField(
                        choices=CHART_CONFIGURATION_CHOICES, max_length=16, null=True
                    ),
                ),
                (
                    'metric',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=swapper.get_model_name('monitoring', 'Metric'),
                    ),
                ),
            ],
            options={
                'abstract': False,
                'swappable': swapper.swappable_setting('monitoring', 'Chart'),
            },
        ),
        migrations.CreateModel(
            name='AlertSettings',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    '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',
                    ),
                ),
                (
                    'custom_operator',
                    models.CharField(
                        blank=True,
                        choices=[('<', 'less than'), ('>', 'greater than')],
                        max_length=1,
                        null=True,
                        verbose_name='operator',
                    ),
                ),
                (
                    'custom_threshold',
                    models.FloatField(
                        blank=True,
                        help_text='threshold value',
                        null=True,
                        verbose_name='threshold value',
                    ),
                ),
                (
                    'custom_tolerance',
                    models.PositiveIntegerField(
                        blank=True,
                        help_text='for how many minutes should the threshold value be crossed before'
                        ' an alert is sent? A value of zero means the alert is sent immediately',
                        null=True,
                        validators=[django.core.validators.MaxValueValidator(10080)],
                        verbose_name='threshold tolerance',
                    ),
                ),
                (
                    'metric',
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=swapper.get_model_name('monitoring', 'Metric'),
                    ),
                ),
                (
                    'is_active',
                    models.BooleanField(
                        default=True,
                        help_text='whether alerts are enabled for this metric, uncheck to disable'
                        ' this alert for this object and all users',
                        verbose_name='Alerts enabled',
                    ),
                ),
            ],
            options={
                'verbose_name': 'Alert settings',
                'verbose_name_plural': 'Alert settings',
                'abstract': False,
                'swappable': swapper.swappable_setting('monitoring', 'AlertSettings'),
            },
        ),
    ]
예제 #5
0
 class Meta:
     swappable = swapper.swappable_setting('wagtail_review', 'Review')
예제 #6
0
    class Meta:
        """
        Meta class for AbstractDegree
        """

        swappable = swapper.swappable_setting('kernel', 'Degree')
    class Meta:
        """
        Meta class for JointFaculty
        """

        swappable = swapper.swappable_setting('kernel', 'JointFaculty')
예제 #8
0
class Migration(migrations.Migration):

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
        swapper.dependency('config', 'Device', '0004_add_device_model'),
    ]

    operations = [
        migrations.CreateModel(
            name='Check',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    'created',
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name='created',
                    ),
                ),
                (
                    'modified',
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name='modified',
                    ),
                ),
                ('name', models.CharField(db_index=True, max_length=64)),
                ('active', models.BooleanField(db_index=True, default=True)),
                ('description', models.TextField(blank=True,
                                                 help_text='Notes')),
                (
                    'object_id',
                    models.CharField(blank=True, db_index=True, max_length=36),
                ),
                (
                    'check',
                    models.CharField(
                        choices=CHECK_CLASSES,
                        db_index=True,
                        help_text='Select check type',
                        max_length=128,
                        verbose_name='check type',
                    ),
                ),
                (
                    'params',
                    jsonfield.fields.JSONField(
                        blank=True,
                        default=dict,
                        dump_kwargs={'indent': 4},
                        help_text='parameters needed to perform the check',
                        load_kwargs={
                            'object_pairs_hook': collections.OrderedDict
                        },
                        verbose_name='parameters',
                    ),
                ),
                (
                    'content_type',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to='contenttypes.contenttype',
                    ),
                ),
            ],
            options={
                'abstract': False,
                'swappable': swapper.swappable_setting('check', 'Check'),
                'unique_together': {('name', 'object_id', 'content_type')},
            },
        )
    ]
예제 #9
0
 class Meta(AbstractIpAddress.Meta):
     abstract = False
     swappable = swappable_setting('django_ipam', 'IpAddress')
예제 #10
0
 class Meta(AbstractNas.Meta):
     abstract = False
     swappable = swappable_setting('openwisp_radius', 'Nas')
예제 #11
0
class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        swapper.dependency('contacts', 'Contact'),
    ]

    operations = [
        migrations.CreateModel(
            name='Contact',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('study_id',
                 models.CharField(help_text=b'* Use Barcode Scanner',
                                  unique=True,
                                  max_length=10,
                                  verbose_name=b'Study ID')),
                ('anc_num',
                 models.CharField(max_length=15, verbose_name=b'ANC #')),
                ('ccc_num',
                 models.CharField(max_length=15,
                                  null=True,
                                  verbose_name=b'CCC #',
                                  blank=True)),
                ('facility',
                 models.CharField(max_length=15,
                                  choices=[(b'mathare', b'Mathare'),
                                           (b'bondo', b'Bondo'),
                                           (b'ahero', b'Ahero'),
                                           (b'siaya', b'Siaya'),
                                           (b'rachuonyo', b'Rachuonyo'),
                                           (b'riruta', b'Riruta')])),
                ('study_group',
                 models.CharField(max_length=10,
                                  verbose_name=b'Group',
                                  choices=[(b'control', b'Control'),
                                           (b'one-way', b'One Way'),
                                           (b'two-way', b'Two Way')])),
                ('send_day',
                 models.IntegerField(default=0,
                                     verbose_name=b'Send Day',
                                     choices=[(0, b'Monday'), (1, b'Tuesday'),
                                              (2, b'Wednesday'),
                                              (3, b'Thursday'), (4, b'Friday'),
                                              (5, b'Satuday'),
                                              (6, b'Sunday')])),
                ('send_time',
                 models.IntegerField(default=8,
                                     verbose_name=b'Send Time',
                                     choices=[(8, b'Morning (8 AM)'),
                                              (13, b'Afternoon (1 PM)'),
                                              (20, b'Evening (8 PM)')])),
                ('nickname', models.CharField(max_length=20)),
                ('birthdate', models.DateField(verbose_name=b'DOB')),
                ('partner_name',
                 models.CharField(max_length=40,
                                  verbose_name=b'Partner Name',
                                  blank=True)),
                ('relationship_status',
                 models.CharField(blank=True,
                                  max_length=15,
                                  verbose_name=b'Relationship Status',
                                  choices=[(b'single', b'Single'),
                                           (b'partner', b'Partner'),
                                           (b'married', b'Married'),
                                           (b'seperated', b'Seperated')])),
                ('previous_pregnancies',
                 models.IntegerField(help_text=b'* excluding current',
                                     null=True,
                                     blank=True)),
                ('phone_shared',
                 models.NullBooleanField(verbose_name=b'Phone Shared')),
                ('status',
                 models.CharField(default=b'pregnant',
                                  max_length=15,
                                  choices=[(b'pregnant', b'Pregnant'),
                                           (b'over', b'Post-Date'),
                                           (b'post', b'Post-Partum'),
                                           (b'ccc', b'CCC'),
                                           (b'completed', b'Completed'),
                                           (b'stopped', b'Withdrew'),
                                           (b'loss', b'SAE opt-in'),
                                           (b'sae', b'SAE opt-out'),
                                           (b'other', b'Admin Stop'),
                                           (b'quit', b'Left Study')])),
                ('language',
                 models.CharField(default=b'english',
                                  max_length=10,
                                  choices=[(b'english', b'English'),
                                           (b'luo', b'Luo'),
                                           (b'swahili', b'Swahili')])),
                ('condition',
                 models.CharField(default=b'normal',
                                  max_length=15,
                                  choices=[(b'art', b'1 - Starting ART'),
                                           (b'adolescent', b'2 - Adolescent'),
                                           (b'first',
                                            b'3 - First Time Mother'),
                                           (b'normal', b'4 -  Normal'),
                                           (b'multiple', b'5 - Twins')])),
                ('due_date',
                 models.DateField(verbose_name=b'Estimated Delivery Date')),
                ('delivery_date',
                 models.DateField(null=True,
                                  verbose_name=b'Delivery Date',
                                  blank=True)),
                ('delivery_source',
                 models.CharField(blank=True,
                                  max_length=10,
                                  verbose_name=b'Delivery Notification Source',
                                  choices=[(b'phone', b'Phone'),
                                           (b'sms', b'SMS'),
                                           (b'visit', b'Clinic Visit'),
                                           (b'm2m', b'Mothers to Mothers'),
                                           (b'other', b'Other')])),
                ('art_initiation',
                 models.DateField(help_text=b'Date of ART Initiation',
                                  null=True,
                                  verbose_name=b'ART Initiation',
                                  blank=True)),
                ('hiv_disclosed',
                 models.NullBooleanField(verbose_name=b'HIV Disclosed')),
                ('hiv_messaging',
                 models.CharField(default=b'none',
                                  max_length=15,
                                  verbose_name=b'HIV Messaging',
                                  choices=[(b'none', b'No HIV Messaging'),
                                           (b'initiated',
                                            b'HIV Content If Initiated'),
                                           (b'system', b'HIV Content Allowed')
                                           ])),
                ('child_hiv_status',
                 models.NullBooleanField(verbose_name=b'Child HIV Status')),
                ('family_planning',
                 models.CharField(blank=True,
                                  max_length=10,
                                  verbose_name=b'Family Planning',
                                  choices=[(b'none', b'None'),
                                           (b'iud', b'IUD'),
                                           (b'pill', b'Pills'),
                                           (b'depot', b'Depot'),
                                           (b'implant', b'Implant')])),
                ('loss_date',
                 models.DateField(help_text=b'SAE date if applicable',
                                  null=True,
                                  blank=True)),
                ('last_msg_client',
                 models.DateField(
                     help_text=b'Date of last client message received',
                     null=True,
                     editable=False,
                     blank=True)),
                ('last_msg_system',
                 models.DateField(
                     help_text=b'Date of last system message sent',
                     null=True,
                     editable=False,
                     blank=True)),
                ('is_validated', models.BooleanField(default=False)),
                ('validation_key', models.CharField(max_length=5, blank=True)),
            ],
            options={
                'swappable': swapper.swappable_setting('contacts', 'Contact'),
            },
        ),
        migrations.CreateModel(
            name='Connection',
            fields=[
                ('identity',
                 models.CharField(max_length=25,
                                  serialize=False,
                                  primary_key=True)),
                ('description',
                 models.CharField(
                     help_text=
                     b'Description of phone numbers relationship to contact',
                     max_length=30,
                     null=True,
                     blank=True)),
                ('is_primary',
                 models.BooleanField(default=False, verbose_name=b'Primary')),
                ('contact',
                 models.ForeignKey(blank=True,
                                   to=swapper.get_model_name(
                                       'contacts', 'Contact'),
                                   null=True)),
            ],
        ),
        migrations.CreateModel(
            name='EventLog',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('event',
                 models.CharField(help_text=b'Event Name', max_length=25)),
                ('data', jsonfield.fields.JSONField()),
                ('user', models.ForeignKey(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='Message',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('text',
                 models.TextField(help_text=b'Text of the SMS message')),
                ('is_outgoing',
                 models.BooleanField(default=True, verbose_name=b'Out')),
                ('is_system',
                 models.BooleanField(default=True, verbose_name=b'System')),
                ('is_viewed',
                 models.BooleanField(default=False, verbose_name=b'Viewed')),
                ('is_related', models.NullBooleanField(default=None)),
                ('action_time',
                 models.DateTimeField(default=None, null=True, blank=True)),
                ('translated_text',
                 models.TextField(default=b'',
                                  help_text=b'Text of the translated message',
                                  max_length=1000,
                                  blank=True)),
                ('translation_status',
                 models.CharField(default=b'todo',
                                  help_text=b'Status of translation',
                                  max_length=5,
                                  verbose_name=b'Translated',
                                  choices=[(b'todo', b'Todo'),
                                           (b'none', b'None'),
                                           (b'done', b'Done'),
                                           (b'auto', b'Auto'),
                                           (b'cust', b'Custom')])),
                ('translation_time', models.DateTimeField(null=True,
                                                          blank=True)),
                ('languages',
                 models.CharField(
                     default=b'',
                     help_text=b'Semi colon seperated list of languages',
                     max_length=50,
                     blank=True)),
                ('topic',
                 models.CharField(default=b'',
                                  help_text=b'The topic of this message',
                                  max_length=25,
                                  blank=True)),
                ('external_id', models.CharField(max_length=50, blank=True)),
                ('external_success',
                 models.NullBooleanField(verbose_name=b'Success')),
                ('external_status',
                 models.CharField(blank=True,
                                  max_length=50,
                                  choices=[(b'', b'Received'),
                                           (b'Success', b'Success'),
                                           (b'Failed', b'Failed'),
                                           (b'Sent', b'Sent'),
                                           (b'Message Rejected By Gateway',
                                            b'Message Rejected By Gateway'),
                                           (b'Could Not Send',
                                            b'Could Not Send')])),
                ('external_success_time',
                 models.DateTimeField(default=None, null=True, blank=True)),
                ('external_data', jsonfield.fields.JSONField(blank=True)),
                ('auto', models.CharField(max_length=50, blank=True)),
                ('admin_user',
                 models.ForeignKey(blank=True,
                                   to=settings.AUTH_USER_MODEL,
                                   null=True)),
                ('connection', models.ForeignKey(to='contacts.Connection')),
                ('contact',
                 models.ForeignKey(blank=True,
                                   to=settings.CONTACTS_CONTACT_MODEL,
                                   null=True)),
                ('parent',
                 models.ForeignKey(related_name='replies',
                                   blank=True,
                                   to='contacts.Message',
                                   null=True)),
            ],
            options={
                'ordering': ('-created', ),
            },
        ),
        migrations.CreateModel(
            name='Note',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('comment', models.TextField(blank=True)),
                ('admin',
                 models.ForeignKey(blank=True,
                                   to=settings.AUTH_USER_MODEL,
                                   null=True)),
                ('participant',
                 models.ForeignKey(
                     to=swapper.get_model_name('contacts', 'Contact'))),
            ],
            options={
                'ordering': ('-created', ),
            },
        ),
        migrations.CreateModel(
            name='PhoneCall',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('is_outgoing', models.BooleanField(default=False)),
                ('outcome',
                 models.CharField(default=b'answered',
                                  max_length=10,
                                  choices=[(b'no_ring', b'No Ring'),
                                           (b'no_answer', b'No Answer'),
                                           (b'answered', b'Answered')])),
                ('length', models.IntegerField(null=True, blank=True)),
                ('comment', models.TextField(null=True, blank=True)),
                ('admin_user',
                 models.ForeignKey(blank=True,
                                   to=settings.AUTH_USER_MODEL,
                                   null=True)),
                ('connection', models.ForeignKey(to='contacts.Connection')),
                ('contact',
                 models.ForeignKey(
                     to=swapper.get_model_name('contacts', 'Contact'))),
            ],
            options={
                'ordering': ('-created', ),
            },
        ),
        migrations.CreateModel(
            name='Practitioner',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('facility',
                 models.CharField(max_length=15,
                                  choices=[(b'mathare', b'Mathare'),
                                           (b'bondo', b'Bondo'),
                                           (b'ahero', b'Ahero'),
                                           (b'siaya', b'Siaya'),
                                           (b'rachuonyo', b'Rachuonyo'),
                                           (b'riruta', b'Riruta')])),
                ('password_changed', models.BooleanField(default=False)),
                ('user', models.OneToOneField(to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ScheduledPhoneCall',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('scheduled', models.DateField()),
                ('arrived',
                 models.DateField(default=None, null=True, blank=True)),
                ('notification_last_seen',
                 models.DateField(default=None, null=True, blank=True)),
                ('notify_count', models.IntegerField(default=0)),
                ('status',
                 models.CharField(default=b'pending',
                                  help_text=b'current status of event',
                                  max_length=15,
                                  choices=[(b'pending', b'Pending'),
                                           (b'missed', b'Missed'),
                                           (b'deleted', b'Deleted'),
                                           (b'attended', b'Attended')])),
                ('call_type',
                 models.CharField(default=b'm',
                                  max_length=2,
                                  choices=[(b'm', b'One Month'),
                                           (b'y', b'One Year')])),
                ('participant',
                 models.ForeignKey(
                     to=swapper.get_model_name('contacts', 'Contact'))),
            ],
            options={
                'ordering': ('-scheduled', ),
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='StatusChange',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('old', models.CharField(max_length=20)),
                ('new', models.CharField(max_length=20)),
                ('type', models.CharField(default=b'status', max_length=10)),
                ('comment', models.TextField(blank=True)),
                ('contact',
                 models.ForeignKey(
                     to=swapper.get_model_name('contacts', 'Contact'))),
            ],
        ),
        migrations.CreateModel(
            name='Visit',
            fields=[
                ('id',
                 models.AutoField(verbose_name='ID',
                                  serialize=False,
                                  auto_created=True,
                                  primary_key=True)),
                ('created',
                 models.DateTimeField(default=django.utils.timezone.now,
                                      editable=False)),
                ('modified', models.DateTimeField(auto_now=True)),
                ('scheduled', models.DateField()),
                ('arrived',
                 models.DateField(default=None, null=True, blank=True)),
                ('notification_last_seen',
                 models.DateField(default=None, null=True, blank=True)),
                ('notify_count', models.IntegerField(default=0)),
                ('status',
                 models.CharField(default=b'pending',
                                  help_text=b'current status of event',
                                  max_length=15,
                                  choices=[(b'pending', b'Pending'),
                                           (b'missed', b'Missed'),
                                           (b'deleted', b'Deleted'),
                                           (b'attended', b'Attended')])),
                ('comment', models.TextField(null=True, blank=True)),
                ('visit_type',
                 models.CharField(default=b'clinic',
                                  max_length=25,
                                  choices=[(b'clinic', b'Clinic Visit'),
                                           (b'study', b'Study Visit'),
                                           (b'both', b'Both'),
                                           (b'delivery', b'Delivery')])),
                ('missed_sms_last_sent',
                 models.DateField(default=None, null=True, blank=True)),
                ('missed_sms_count', models.IntegerField(default=0)),
                ('participant',
                 models.ForeignKey(
                     to=swapper.get_model_name('contacts', 'Contact'))),
            ],
            options={
                'ordering': ('-scheduled', ),
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='phonecall',
            name='scheduled',
            field=models.ForeignKey(blank=True,
                                    to='contacts.ScheduledPhoneCall',
                                    null=True),
        ),
    ]
예제 #12
0
 class Meta(AbstractRadiusPostAuth.Meta):
     abstract = False
     swappable = swappable_setting('openwisp_radius', 'RadiusPostAuth')
예제 #13
0
 class Meta(AbstractRadiusUserGroup.Meta):
     abstract = False
     swappable = swappable_setting('openwisp_radius', 'RadiusUserGroup')
예제 #14
0
 class Meta(AbstractRadiusGroupReply.Meta):
     abstract = False
     swappable = swappable_setting('openwisp_radius', 'RadiusGroupReply')
예제 #15
0
파일: models.py 프로젝트: TipOfit/vera

class Parameter(BaseParameter):
    class Meta(BaseParameter.Meta):
        db_table = 'wq_parameter'
        swappable = swapper.swappable_setting('vera', 'Parameter')


class Result(BaseResult):
    class Meta(BaseResult.Meta):
        db_table = 'wq_result'
        swappable = swapper.swappable_setting('vera', 'Result')


EventResult = create_eventresult_model(
    Event, Result, swappable=swapper.swappable_setting('vera', 'EventResult')
)

if ((swapper.is_swapped('vera', 'Event')
        or swapper.is_swapped('vera', 'Result'))
        and not swapper.is_swapped('vera', 'EventResult')):
    raise ImproperlyConfigured(
        "Event or Result was swapped but EventResult was not!"
    )


def nest_ordering(prefix, ordering, ignore_reverse=False):
    nest_order = []
    for field in ordering:
        reverse = ''
        if field.startswith('-'):
예제 #16
0
 class Meta(AbstractSubnet.Meta):
     abstract = False
     swappable = swappable_setting('django_ipam', 'Subnet')
예제 #17
0
 class Meta(BaseContinent.Meta):
     swappable = swapper.swappable_setting('cities', 'Continent')
예제 #18
0
 class Meta(AbstractCa.Meta):
     abstract = False
     swappable = swapper.swappable_setting('django_x509', 'Ca')
예제 #19
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        swapper.dependency('django_freeradius', 'RadiusReply'),
        swapper.dependency('django_freeradius', 'RadiusCheck'),
    ]

    operations = [
        migrations.CreateModel(
            name='Nas',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created', model_utils.fields.AutoCreatedField(default=django.utils.timezone.now, editable=False, verbose_name='created')),
                ('modified', model_utils.fields.AutoLastModifiedField(default=django.utils.timezone.now, editable=False, verbose_name='modified')),
                ('name', models.CharField(db_column='nasname', db_index=True, help_text='NAS Name (or IP address)', max_length=128, unique=True, verbose_name='name')),
                ('short_name', models.CharField(db_column='shortname', max_length=32, verbose_name='short name')),
                ('type', models.CharField(max_length=30, verbose_name='type')),
                ('secret', models.CharField(help_text='Shared Secret', max_length=60, verbose_name='secret')),
                ('ports', models.IntegerField(blank=True, null=True, verbose_name='ports')),
                ('community', models.CharField(blank=True, max_length=50, null=True, verbose_name='community')),
                ('description', models.CharField(max_length=200, null=True, verbose_name='description')),
                ('server', models.CharField(max_length=64, null=True, verbose_name='server')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'Nas'),
                'db_table': 'nas',
                'verbose_name_plural': 'NAS',
                'abstract': False,
                'verbose_name': 'NAS',
            },
        ),
        migrations.CreateModel(
            name='RadiusAccounting',
            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')),
                ('rad_acct_id', models.BigIntegerField(db_column='radacctid', primary_key=True, serialize=False, verbose_name='RADIUS accounting ID')),
                ('acct_session_id', models.CharField(db_column='acctsessionid', db_index=True, max_length=64, verbose_name='accounting session ID')),
                ('acct_unique_id', models.CharField(db_column='acctuniqueid', max_length=32, unique=True, verbose_name='accounting unique ID')),
                ('username', models.CharField(db_index=True, max_length=64, verbose_name='username')),
                ('groupname', models.CharField(max_length=64, verbose_name='group name')),
                ('realm', models.CharField(max_length=64, null=True, verbose_name='realm')),
                ('nas_ip_address', models.CharField(db_column='nasipaddress', db_index=True, max_length=15, verbose_name='NAS IP address')),
                ('nas_port_id', models.CharField(db_column='nasportid', max_length=15, null=True, verbose_name='NAS port ID')),
                ('nas_port_type', models.CharField(db_column='nasporttype', max_length=32, verbose_name='NAS port type')),
                ('acct_start_time', models.DateTimeField(db_column='acctstarttime', db_index=True, verbose_name='Accounting start time')),
                ('acct_stop_time', models.DateTimeField(db_column='acctstoptime', db_index=True, null=True, verbose_name='Accounting stop time')),
                ('acct_session_time', models.IntegerField(db_column='acctsessiontime', db_index=True, null=True, verbose_name='Accounting session time')),
                ('acct_authentic', models.CharField(db_column='acctauthentic', max_length=32, null=True, verbose_name='Accounting authentication')),
                ('connection_info_start', models.CharField(db_column='connectinfo_start', max_length=50, null=True, verbose_name='connection info start')),
                ('connection_info_stop', models.CharField(db_column='connectinfo_stop', max_length=50, null=True, verbose_name='connection info stop')),
                ('acct_input_octets', models.BigIntegerField(db_column='acctinputoctets', null=True, verbose_name='accounting input octets')),
                ('acct_output_octets', models.BigIntegerField(db_column='acctoutputoctets', null=True, verbose_name='accounting output octets')),
                ('calling_station_id', models.CharField(db_column='calledstationid', max_length=50, verbose_name='calling station ID')),
                ('called_station_id', models.CharField(db_column='callingstationid', max_length=50, verbose_name='called station ID')),
                ('acct_terminate_cause', models.CharField(db_column='acctterminatecause', max_length=32, verbose_name='accounting termination cause')),
                ('service_type', models.CharField(db_column='servicetype', max_length=32, null=True, verbose_name='service type')),
                ('framed_protocol', models.CharField(db_column='framedprotocol', max_length=32, null=True, verbose_name='framed protocol')),
                ('framed_ip_address', models.CharField(db_column='framedipaddress', db_index=True, max_length=15, verbose_name='framed IP address')),
                ('acct_start_delay', models.IntegerField(db_column='acctstartdelay', null=True, verbose_name='accounting start delay')),
                ('acct_stop_delay', models.IntegerField(db_column='acctstopdelay', null=True, verbose_name='accounting stop delay')),
                ('xascend_session_svrkey', models.CharField(db_column='xascendsessionsvrkey', max_length=10, null=True, verbose_name='xascend session svrkey')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusAccounting'),
                'db_table': 'radacct',
                'verbose_name_plural': 'accountings',
                'abstract': False,
                'verbose_name': 'accounting',
            },
        ),
        migrations.CreateModel(
            name='RadiusCheck',
            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')),
                ('username', models.CharField(db_index=True, max_length=64, verbose_name='username')),
                ('value', models.CharField(max_length=253, verbose_name='value')),
                ('op', models.CharField(choices=[('=', '='), (':=', ':='), ('==', '=='), ('+=', '+='), ('!=', '!='), ('>', '>'), ('>=', '>='), ('<', '<'), ('<=', '<='), ('=~', '=~'), ('!~', '!~'), ('=*', '=*'), ('!*', '!*')], default=':=', max_length=2, verbose_name='operator')),
                ('attribute', models.CharField(max_length=64, verbose_name='attribute')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusCheck'),
                'db_table': 'radcheck',
                'verbose_name_plural': 'radius checks',
                'abstract': False,
                'verbose_name': 'radius check',
            },
        ),
        migrations.CreateModel(
            name='RadiusGroup',
            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(db_column='id', primary_key=True, serialize=False)),
                ('groupname', models.CharField(db_index=True, max_length=255, unique=True, verbose_name='group name')),
                ('priority', models.IntegerField(default=1, verbose_name='priority')),
                ('notes', models.CharField(blank=True, max_length=64, null=True, verbose_name='notes')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusGroup'),
                'db_table': 'radiusgroup',
                'verbose_name_plural': 'radius groups',
                'abstract': False,
                'verbose_name': 'radius group',
            },
        ),
        migrations.CreateModel(
            name='RadiusGroupCheck',
            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')),
                ('groupname', models.CharField(db_index=True, max_length=64, verbose_name='group name')),
                ('attribute', models.CharField(max_length=64, verbose_name='attribute')),
                ('op', models.CharField(choices=[('=', '='), (':=', ':='), ('==', '=='), ('+=', '+='), ('!=', '!='), ('>', '>'), ('>=', '>='), ('<', '<'), ('<=', '<='), ('=~', '=~'), ('!~', '!~'), ('=*', '=*'), ('!*', '!*')], default=':=', max_length=2, verbose_name='operator')),
                ('value', models.CharField(max_length=253, verbose_name='value')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusGroupCheck'),
                'db_table': 'radgroupcheck',
                'verbose_name_plural': 'radius group checks',
                'abstract': False,
                'verbose_name': 'radius group check',
            },
        ),
        migrations.CreateModel(
            name='RadiusGroupReply',
            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')),
                ('groupname', models.CharField(db_index=True, max_length=64, verbose_name='group name')),
                ('attribute', models.CharField(max_length=64, verbose_name='attribute')),
                ('op', models.CharField(choices=[('=', '='), (':=', ':='), ('+=', '+=')], default='=', max_length=2, verbose_name='operator')),
                ('value', models.CharField(max_length=253, verbose_name='value')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusGroupReply'),
                'db_table': 'radgroupreply',
                'verbose_name_plural': 'radius group replies',
                'abstract': False,
                'verbose_name': 'radius group reply',
            },
        ),
        migrations.CreateModel(
            name='RadiusGroupUsers',
            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(db_column='id', primary_key=True, serialize=False)),
                ('username', models.CharField(max_length=64, unique=True, verbose_name='username')),
                ('groupname', models.CharField(max_length=255, unique=True, verbose_name='group name')),
                ('radius_check', models.ManyToManyField(blank=True, db_column='radiuscheck', to=settings.DJANGO_FREERADIUS_RADIUSCHECK_MODEL, verbose_name='radius check')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusGroupUsers'),
                'db_table': 'radiusgroupusers',
                'verbose_name_plural': 'radius group users',
                'abstract': False,
                'verbose_name': 'radius group users',
            },
        ),
        migrations.CreateModel(
            name='RadiusPostAuth',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('username', models.CharField(max_length=64, verbose_name='username')),
                ('password', models.CharField(db_column='pass', max_length=64, verbose_name='password')),
                ('reply', models.CharField(max_length=32, verbose_name='reply')),
                ('date', models.DateTimeField(auto_now_add=True, db_column='authdate', verbose_name='date')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusPostAuth'),
                'db_table': 'radpostauth',
                'verbose_name_plural': 'radius post authentication logs',
                'abstract': False,
                'verbose_name': 'radius post authentication log',
            },
        ),
        migrations.CreateModel(
            name='RadiusReply',
            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')),
                ('username', models.CharField(db_index=True, max_length=64, verbose_name='username')),
                ('value', models.CharField(max_length=253, verbose_name='value')),
                ('op', models.CharField(choices=[('=', '='), (':=', ':='), ('+=', '+=')], default='=', max_length=2, verbose_name='operator')),
                ('attribute', models.CharField(max_length=64, verbose_name='attribute')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusReply'),
                'db_table': 'radreply',
                'verbose_name_plural': 'radius replies',
                'abstract': False,
                'verbose_name': 'radius reply',
            },
        ),
        migrations.CreateModel(
            name='RadiusUserGroup',
            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')),
                ('username', models.CharField(db_index=True, max_length=64, verbose_name='username')),
                ('groupname', models.CharField(max_length=64, verbose_name='group name')),
                ('priority', models.IntegerField(default=1, verbose_name='priority')),
            ],
            options={
                'swappable': swapper.swappable_setting('django_freeradius', 'RadiusUserGroup'),
                'db_table': 'radusergroup',
                'verbose_name_plural': 'radius user group associations',
                'abstract': False,
                'verbose_name': 'radius user group association',
            },
        ),
        migrations.AddField(
            model_name='radiusgroupusers',
            name='radius_reply',
            field=models.ManyToManyField(blank=True, db_column='radiusreply', to=settings.DJANGO_FREERADIUS_RADIUSREPLY_MODEL, verbose_name='radius reply'),
        ),
    ]
예제 #20
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        dependency('barrier_field', user_data_model_name),
        ('auth', '0009_alter_user_last_name_max_length'),
    ]

    operations = [
        migrations.CreateModel(
            name='User',
            fields=[
                ('id',
                 models.AutoField(auto_created=True,
                                  primary_key=True,
                                  serialize=False,
                                  verbose_name='ID')),
                ('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')),
                ('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_data',
                 models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
                                   to=get_model_name('barrier_field',
                                                     user_data_model_name))),
                ('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={
                'swappable': swappable_setting('barrier_field', 'User'),
            },
            managers=[
                ('objects', django.contrib.auth.models.UserManager()),
            ],
        ),
    ]
예제 #21
0
 class Meta(AbstractTweet.Meta):
     swappable = swappable_setting('twitter_stream', 'Tweet')
예제 #22
0
    class Meta:
        """
        Meta class for Residence
        """

        swappable = swapper.swappable_setting('kernel', 'Residence')
예제 #23
0
class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('sample_config', '0001_initial'),
        swapper.dependency('openwisp_users', 'Organization'),
        swapper.dependency('config', 'Device'),
    ]

    operations = [
        migrations.CreateModel(
            name='Credentials',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    'created',
                    model_utils.fields.AutoCreatedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name='created',
                    ),
                ),
                (
                    'modified',
                    model_utils.fields.AutoLastModifiedField(
                        default=django.utils.timezone.now,
                        editable=False,
                        verbose_name='modified',
                    ),
                ),
                ('name',
                 models.CharField(db_index=True, max_length=64, unique=True)),
                (
                    'connector',
                    models.CharField(
                        choices=connection_settings.CONNECTORS,
                        db_index=True,
                        max_length=128,
                        verbose_name='connection type',
                    ),
                ),
                (
                    'params',
                    jsonfield.fields.JSONField(
                        default=dict,
                        dump_kwargs={'indent': 4},
                        help_text='global connection parameters',
                        load_kwargs={
                            'object_pairs_hook': collections.OrderedDict
                        },
                        verbose_name='parameters',
                    ),
                ),
                (
                    'auto_add',
                    models.BooleanField(
                        default=False,
                        help_text=
                        ('automatically add these credentials to the '
                         'devices of this organization; if no organization is '
                         'specified will be added to all the new devices'),
                        verbose_name='auto add',
                    ),
                ),
                ('details',
                 models.CharField(blank=True, max_length=64, null=True)),
                (
                    'organization',
                    models.ForeignKey(
                        blank=True,
                        null=True,
                        on_delete=django.db.models.deletion.CASCADE,
                        to=swapper.get_model_name('openwisp_users',
                                                  'Organization'),
                        verbose_name='organization',
                    ),
                ),
            ],
            options={
                'verbose_name': 'Access credentials',
                'verbose_name_plural': 'Access credentials',
                'abstract': False,
            },
            bases=(
                openwisp_controller.connection.base.models.ConnectorMixin,
                openwisp_users.mixins.ValidateOrgMixin,
                models.Model,
            ),
        ),
        migrations.CreateModel(
            name='DeviceConnection',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    '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',
                    ),
                ),
                (
                    'update_strategy',
                    models.CharField(
                        blank=True,
                        choices=connection_settings.UPDATE_STRATEGIES,
                        db_index=True,
                        help_text='leave blank to determine automatically',
                        max_length=128,
                        verbose_name='update strategy',
                    ),
                ),
                ('enabled', models.BooleanField(db_index=True, default=True)),
                (
                    'params',
                    jsonfield.fields.JSONField(
                        blank=True,
                        default=dict,
                        dump_kwargs={'indent': 4},
                        help_text=(
                            'local connection parameters (will override the '
                            'global parameters if specified)'),
                        load_kwargs={
                            'object_pairs_hook': collections.OrderedDict
                        },
                        verbose_name='parameters',
                    ),
                ),
                (
                    'is_working',
                    models.BooleanField(blank=True, default=None, null=True),
                ),
                (
                    'failure_reason',
                    models.TextField(blank=True,
                                     verbose_name='reason of failure'),
                ),
                ('last_attempt', models.DateTimeField(blank=True, null=True)),
                ('details',
                 models.CharField(blank=True, max_length=64, null=True)),
                (
                    'credentials',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to='sample_connection.Credentials',
                    ),
                ),
                (
                    'device',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to='sample_config.Device',
                    ),
                ),
            ],
            options={
                'verbose_name': 'Device connection',
                'verbose_name_plural': 'Device connections',
                'abstract': False,
            },
            bases=(
                openwisp_controller.connection.base.models.ConnectorMixin,
                models.Model,
            ),
        ),
        migrations.CreateModel(
            name='Command',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    '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',
                    models.CharField(
                        choices=[
                            ('in-progress', 'in progress'),
                            ('success', 'success'),
                            ('failed', 'failed'),
                        ],
                        default='in-progress',
                        max_length=12,
                    ),
                ),
                (
                    'type',
                    models.CharField(
                        choices=COMMAND_CHOICES,
                        max_length=16,
                    ),
                ),
                (
                    'input',
                    jsonfield.fields.JSONField(
                        blank=True,
                        dump_kwargs={'indent': 4},
                        load_kwargs={
                            'object_pairs_hook': collections.OrderedDict
                        },
                        null=True,
                    ),
                ),
                ('output', models.TextField(blank=True)),
                (
                    'connection',
                    models.ForeignKey(
                        null=True,
                        on_delete=django.db.models.deletion.SET_NULL,
                        to=swapper.get_model_name('connection',
                                                  'DeviceConnection'),
                    ),
                ),
                (
                    'device',
                    models.ForeignKey(
                        on_delete=django.db.models.deletion.CASCADE,
                        to=swapper.get_model_name('config', 'Device'),
                    ),
                ),
            ],
            options={
                'verbose_name': 'Command',
                'verbose_name_plural': 'Commands',
                'ordering': ('created', ),
                'abstract': False,
                'swappable': swapper.swappable_setting('connection',
                                                       'Command'),
            },
        ),
    ]
예제 #24
0
파일: models.py 프로젝트: shaneramey/wq.db
 class Meta:
     swappable = swapper.swappable_setting('mark', 'MarkdownType')
     db_table = "wq_markdowntype"
     abstract = not INSTALLED
예제 #25
0
    class Meta:
        """
        Meta class for Maintainer
        """

        swappable = swapper.swappable_setting('kernel', 'Maintainer')
예제 #26
0
class Migration(migrations.Migration):
    dependencies = [
        ('config', '0018_config_context'),
        ('device_monitoring', '0001_initial'),
    ]
    operations = [
        migrations.CreateModel(
            name='DeviceMonitoring',
            fields=[
                (
                    'id',
                    models.UUIDField(
                        default=uuid.uuid4,
                        editable=False,
                        primary_key=True,
                        serialize=False,
                    ),
                ),
                (
                    '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=[
                            (
                                'unknown',
                                _(app_settings.HEALTH_STATUS_LABELS['unknown']
                                  ),
                            ),
                            ('ok', _(app_settings.HEALTH_STATUS_LABELS['ok'])),
                            (
                                'problem',
                                _(app_settings.HEALTH_STATUS_LABELS['problem']
                                  ),
                            ),
                            (
                                'critical',
                                _(app_settings.HEALTH_STATUS_LABELS['critical']
                                  ),
                            ),
                        ],
                        default='unknown',
                        db_index=True,
                        help_text=DeviceMonitoring._meta.get_field(
                            'status').help_text,
                        max_length=100,
                        no_check_for_status=True,
                        verbose_name='health status',
                    ),
                ),
                (
                    'device',
                    models.OneToOneField(
                        on_delete=django.db.models.deletion.CASCADE,
                        related_name='monitoring',
                        to=swapper.get_model_name('config', 'Device'),
                    ),
                ),
            ],
            options={
                'abstract':
                False,
                'swappable':
                swapper.swappable_setting('device_monitoring',
                                          'DeviceMonitoring'),
            },
        ),
        migrations.RunPython(create_device_monitoring,
                             reverse_code=migrations.RunPython.noop),
    ]
예제 #27
0
 class Meta(AbstractConfig.Meta):
     abstract = False
     swappable = swapper.swappable_setting('config', 'Config')
예제 #28
0
 class Meta(BaseCountry.Meta):
     swappable = swapper.swappable_setting('cities', 'Country')
예제 #29
0
 class Meta(AbstractVpnClient.Meta):
     abstract = False
     swappable = swapper.swappable_setting('config', 'VpnClient')
예제 #30
0
 class Meta(BaseCity.Meta):
     swappable = swapper.swappable_setting('cities', 'City')
예제 #31
0
 class Meta:
     swappable = swapper.swappable_setting('wcore', 'Service')
예제 #32
0
파일: models.py 프로젝트: wq/vera
        if event:
            EventResult.objects.set_for_event(event)

    return EventResult


# Default implementation of the above classes, can be swapped
class Result(BaseResult):
    class Meta(BaseResult.Meta):
        db_table = 'wq_result'
        swappable = swapper.swappable_setting('results', 'Result')


EventResult = create_eventresult_model(
    Event, Result,
    swappable=swapper.swappable_setting('results', 'EventResult')
)

if ((swapper.is_swapped('series', 'Event')
        or swapper.is_swapped('results', 'Result'))
        and not swapper.is_swapped('results', 'EventResult')):
    raise ImproperlyConfigured(
        "Event or Result was swapped but EventResult was not!"
    )


def nest_ordering(prefix, ordering, ignore_reverse=False):
    nest_order = []
    for field in ordering:
        reverse = ''
        if field.startswith('-'):