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

Closes #9623: Implement saved filters (#10801)

* Initial work on saved filters

* Return only enabled/shared filters

* Add tests

* Clean up filtering of usable SavedFilters
This commit is contained in:
Jeremy Stretch
2022-11-02 12:27:53 -04:00
committed by GitHub
parent ea61a540cd
commit 484efdaf75
37 changed files with 821 additions and 138 deletions

View File

@ -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
#