mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-18 19:32:24 -06:00
* Replace site FK on Prefix with scope GFK * Add denormalized relations * Update prefix filters * Add generic relations for Prefix * Update GraphQL type for Prefix model * Fix tests; misc cleanup * Remove prefix_count from SiteSerializer * Remove site field from PrefixBulkEditForm * Restore scope filters for prefixes * Fix scope population on PrefixForm init * Show scope type * Assign scope during bulk import of prefixes * Correct handling of GenericForeignKey in PrefixForm * Add prefix counts to all scoped objects * Fix migration; linter fix * Add limit_choices_to on scope_type * Clean up cache_related_objects() * Enable bulk editing prefix scope
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import json
|
||||
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import ArrayField, RangeField
|
||||
from django.core.exceptions import FieldDoesNotExist
|
||||
@@ -120,6 +121,10 @@ class ModelTestCase(TestCase):
|
||||
else:
|
||||
model_dict[key] = sorted([obj.pk for obj in value])
|
||||
|
||||
# Handle GenericForeignKeys
|
||||
elif value and type(field) is GenericForeignKey:
|
||||
model_dict[key] = value.pk
|
||||
|
||||
elif api:
|
||||
|
||||
# Replace ContentType numeric IDs with <app_label>.<model>
|
||||
|
||||
Reference in New Issue
Block a user