mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
15532 fix autotype_decorator for method fields
This commit is contained in:
parent
379fe7c160
commit
815cab5c9a
@ -4,6 +4,7 @@ from typing import List
|
|||||||
import django_filters
|
import django_filters
|
||||||
import strawberry
|
import strawberry
|
||||||
import strawberry_django
|
import strawberry_django
|
||||||
|
from django.core.exceptions import FieldDoesNotExist
|
||||||
from strawberry import auto
|
from strawberry import auto
|
||||||
from ipam.fields import ASNField
|
from ipam.fields import ASNField
|
||||||
from netbox.graphql.scalars import BigInt
|
from netbox.graphql.scalars import BigInt
|
||||||
@ -164,7 +165,11 @@ def autotype_decorator(filterset):
|
|||||||
should_create_function = False
|
should_create_function = False
|
||||||
attr_type = auto
|
attr_type = auto
|
||||||
if fieldname not in cls.__annotations__:
|
if fieldname not in cls.__annotations__:
|
||||||
field = model._meta.get_field(fieldname)
|
try:
|
||||||
|
field = model._meta.get_field(fieldname)
|
||||||
|
except FieldDoesNotExist:
|
||||||
|
continue
|
||||||
|
|
||||||
if isinstance(field, CounterCacheField):
|
if isinstance(field, CounterCacheField):
|
||||||
should_create_function = True
|
should_create_function = True
|
||||||
attr_type = BigInt | None
|
attr_type = BigInt | None
|
||||||
|
Loading…
Reference in New Issue
Block a user