1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

#3892: Convert WEBHOOK_MODELS to a Q object

This commit is contained in:
Jeremy Stretch
2020-01-15 16:18:47 -05:00
parent d9437a08f0
commit 215b4d0b3f
6 changed files with 58 additions and 44 deletions

View File

@@ -43,6 +43,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='webhook',
name='obj_type',
field=models.ManyToManyField(limit_choices_to=extras.models.get_webhook_models, related_name='webhooks', to='contenttypes.ContentType'),
field=models.ManyToManyField(related_name='webhooks', to='contenttypes.ContentType'),
),
]

View File

@@ -125,7 +125,7 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='webhook',
name='obj_type',
field=models.ManyToManyField(limit_choices_to=extras.models.get_webhook_models, related_name='webhooks', to='contenttypes.ContentType'),
field=models.ManyToManyField(related_name='webhooks', to='contenttypes.ContentType'),
),
migrations.RunSQL(
sql="SELECT setval('extras_tag_id_seq', (SELECT id FROM extras_tag ORDER BY id DESC LIMIT 1) + 1)",

View File

@@ -1,4 +1,4 @@
# Generated by Django 2.2.8 on 2020-01-15 21:11
# Generated by Django 2.2.8 on 2020-01-15 21:18
from django.db import migrations, models
import django.db.models.deletion
@@ -31,4 +31,9 @@ class Migration(migrations.Migration):
name='type',
field=models.ForeignKey(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'circuits'), ('model__in', ['provider'])), models.Q(('app_label', 'dcim'), ('model__in', ['device', 'interface', 'site'])), _connector='OR')), on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType'),
),
migrations.AlterField(
model_name='webhook',
name='obj_type',
field=models.ManyToManyField(limit_choices_to=models.Q(models.Q(models.Q(('app_label', 'circuits'), ('model__in', ['circuit', 'provider'])), models.Q(('app_label', 'dcim'), ('model__in', ['cable', 'consoleport', 'consoleserverport', 'device', 'devicebay', 'devicetype', 'frontport', 'interface', 'inventoryitem', 'manufacturer', 'poweroutlet', 'powerpanel', 'powerport', 'powerfeed', 'rack', 'rearport', 'region', 'site', 'virtualchassis'])), models.Q(('app_label', 'ipam'), ('model__in', ['aggregate', 'ipaddress', 'prefix', 'service', 'vlan', 'vrf'])), models.Q(('app_label', 'secrets'), ('model__in', ['secret'])), models.Q(('app_label', 'tenancy'), ('model__in', ['tenant'])), models.Q(('app_label', 'virtualization'), ('model__in', ['cluster', 'virtualmachine'])), _connector='OR')), related_name='webhooks', to='contenttypes.ContentType'),
),
]