mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
* Initial work on saved filters * Return only enabled/shared filters * Add tests * Clean up filtering of usable SavedFilters
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
import json
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.contrib.postgres.fields import ArrayField
|
||||
from django.core.exceptions import FieldDoesNotExist
|
||||
from django.db.models import ManyToManyField
|
||||
from django.db.models import ManyToManyField, JSONField
|
||||
from django.forms.models import model_to_dict
|
||||
from django.test import Client, TestCase as _TestCase
|
||||
from netaddr import IPNetwork
|
||||
@ -132,6 +134,10 @@ class ModelTestCase(TestCase):
|
||||
if type(instance._meta.get_field(key)) is ArrayField:
|
||||
model_dict[key] = ','.join([str(v) for v in value])
|
||||
|
||||
# JSON
|
||||
if type(instance._meta.get_field(key)) is JSONField and value is not None:
|
||||
model_dict[key] = json.dumps(value)
|
||||
|
||||
return model_dict
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user