mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Merge branch 'develop' into feature
This commit is contained in:
commit
2a0d76d564
@ -53,23 +53,23 @@ class LinkPeerType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == CircuitTermination:
|
if type(instance) is CircuitTermination:
|
||||||
return CircuitTerminationType
|
return CircuitTerminationType
|
||||||
if type(instance) == ConsolePortType:
|
if type(instance) is ConsolePortType:
|
||||||
return ConsolePortType
|
return ConsolePortType
|
||||||
if type(instance) == ConsoleServerPort:
|
if type(instance) is ConsoleServerPort:
|
||||||
return ConsoleServerPortType
|
return ConsoleServerPortType
|
||||||
if type(instance) == FrontPort:
|
if type(instance) is FrontPort:
|
||||||
return FrontPortType
|
return FrontPortType
|
||||||
if type(instance) == Interface:
|
if type(instance) is Interface:
|
||||||
return InterfaceType
|
return InterfaceType
|
||||||
if type(instance) == PowerFeed:
|
if type(instance) is PowerFeed:
|
||||||
return PowerFeedType
|
return PowerFeedType
|
||||||
if type(instance) == PowerOutlet:
|
if type(instance) is PowerOutlet:
|
||||||
return PowerOutletType
|
return PowerOutletType
|
||||||
if type(instance) == PowerPort:
|
if type(instance) is PowerPort:
|
||||||
return PowerPortType
|
return PowerPortType
|
||||||
if type(instance) == RearPort:
|
if type(instance) is RearPort:
|
||||||
return RearPortType
|
return RearPortType
|
||||||
|
|
||||||
|
|
||||||
@ -89,23 +89,23 @@ class CableTerminationTerminationType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == CircuitTermination:
|
if type(instance) is CircuitTermination:
|
||||||
return CircuitTerminationType
|
return CircuitTerminationType
|
||||||
if type(instance) == ConsolePortType:
|
if type(instance) is ConsolePortType:
|
||||||
return ConsolePortType
|
return ConsolePortType
|
||||||
if type(instance) == ConsoleServerPort:
|
if type(instance) is ConsoleServerPort:
|
||||||
return ConsoleServerPortType
|
return ConsoleServerPortType
|
||||||
if type(instance) == FrontPort:
|
if type(instance) is FrontPort:
|
||||||
return FrontPortType
|
return FrontPortType
|
||||||
if type(instance) == Interface:
|
if type(instance) is Interface:
|
||||||
return InterfaceType
|
return InterfaceType
|
||||||
if type(instance) == PowerFeed:
|
if type(instance) is PowerFeed:
|
||||||
return PowerFeedType
|
return PowerFeedType
|
||||||
if type(instance) == PowerOutlet:
|
if type(instance) is PowerOutlet:
|
||||||
return PowerOutletType
|
return PowerOutletType
|
||||||
if type(instance) == PowerPort:
|
if type(instance) is PowerPort:
|
||||||
return PowerPortType
|
return PowerPortType
|
||||||
if type(instance) == RearPort:
|
if type(instance) is RearPort:
|
||||||
return RearPortType
|
return RearPortType
|
||||||
|
|
||||||
|
|
||||||
@ -123,19 +123,19 @@ class InventoryItemTemplateComponentType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == ConsolePortTemplate:
|
if type(instance) is ConsolePortTemplate:
|
||||||
return ConsolePortTemplateType
|
return ConsolePortTemplateType
|
||||||
if type(instance) == ConsoleServerPortTemplate:
|
if type(instance) is ConsoleServerPortTemplate:
|
||||||
return ConsoleServerPortTemplateType
|
return ConsoleServerPortTemplateType
|
||||||
if type(instance) == FrontPortTemplate:
|
if type(instance) is FrontPortTemplate:
|
||||||
return FrontPortTemplateType
|
return FrontPortTemplateType
|
||||||
if type(instance) == InterfaceTemplate:
|
if type(instance) is InterfaceTemplate:
|
||||||
return InterfaceTemplateType
|
return InterfaceTemplateType
|
||||||
if type(instance) == PowerOutletTemplate:
|
if type(instance) is PowerOutletTemplate:
|
||||||
return PowerOutletTemplateType
|
return PowerOutletTemplateType
|
||||||
if type(instance) == PowerPortTemplate:
|
if type(instance) is PowerPortTemplate:
|
||||||
return PowerPortTemplateType
|
return PowerPortTemplateType
|
||||||
if type(instance) == RearPortTemplate:
|
if type(instance) is RearPortTemplate:
|
||||||
return RearPortTemplateType
|
return RearPortTemplateType
|
||||||
|
|
||||||
|
|
||||||
@ -153,17 +153,17 @@ class InventoryItemComponentType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == ConsolePort:
|
if type(instance) is ConsolePort:
|
||||||
return ConsolePortType
|
return ConsolePortType
|
||||||
if type(instance) == ConsoleServerPort:
|
if type(instance) is ConsoleServerPort:
|
||||||
return ConsoleServerPortType
|
return ConsoleServerPortType
|
||||||
if type(instance) == FrontPort:
|
if type(instance) is FrontPort:
|
||||||
return FrontPortType
|
return FrontPortType
|
||||||
if type(instance) == Interface:
|
if type(instance) is Interface:
|
||||||
return InterfaceType
|
return InterfaceType
|
||||||
if type(instance) == PowerOutlet:
|
if type(instance) is PowerOutlet:
|
||||||
return PowerOutletType
|
return PowerOutletType
|
||||||
if type(instance) == PowerPort:
|
if type(instance) is PowerPort:
|
||||||
return PowerPortType
|
return PowerPortType
|
||||||
if type(instance) == RearPort:
|
if type(instance) is RearPort:
|
||||||
return RearPortType
|
return RearPortType
|
||||||
|
@ -24,11 +24,11 @@ class IPAddressAssignmentType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == Interface:
|
if type(instance) is Interface:
|
||||||
return InterfaceType
|
return InterfaceType
|
||||||
if type(instance) == FHRPGroup:
|
if type(instance) is FHRPGroup:
|
||||||
return FHRPGroupType
|
return FHRPGroupType
|
||||||
if type(instance) == VMInterface:
|
if type(instance) is VMInterface:
|
||||||
return VMInterfaceType
|
return VMInterfaceType
|
||||||
|
|
||||||
|
|
||||||
@ -42,11 +42,11 @@ class L2VPNAssignmentType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == Interface:
|
if type(instance) is Interface:
|
||||||
return InterfaceType
|
return InterfaceType
|
||||||
if type(instance) == VLAN:
|
if type(instance) is VLAN:
|
||||||
return VLANType
|
return VLANType
|
||||||
if type(instance) == VMInterface:
|
if type(instance) is VMInterface:
|
||||||
return VMInterfaceType
|
return VMInterfaceType
|
||||||
|
|
||||||
|
|
||||||
@ -59,9 +59,9 @@ class FHRPGroupInterfaceType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == Interface:
|
if type(instance) is Interface:
|
||||||
return InterfaceType
|
return InterfaceType
|
||||||
if type(instance) == VMInterface:
|
if type(instance) is VMInterface:
|
||||||
return VMInterfaceType
|
return VMInterfaceType
|
||||||
|
|
||||||
|
|
||||||
@ -79,17 +79,17 @@ class VLANGroupScopeType(graphene.Union):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def resolve_type(cls, instance, info):
|
def resolve_type(cls, instance, info):
|
||||||
if type(instance) == Cluster:
|
if type(instance) is Cluster:
|
||||||
return ClusterType
|
return ClusterType
|
||||||
if type(instance) == ClusterGroup:
|
if type(instance) is ClusterGroup:
|
||||||
return ClusterGroupType
|
return ClusterGroupType
|
||||||
if type(instance) == Location:
|
if type(instance) is Location:
|
||||||
return LocationType
|
return LocationType
|
||||||
if type(instance) == Rack:
|
if type(instance) is Rack:
|
||||||
return RackType
|
return RackType
|
||||||
if type(instance) == Region:
|
if type(instance) is Region:
|
||||||
return RegionType
|
return RegionType
|
||||||
if type(instance) == Site:
|
if type(instance) is Site:
|
||||||
return SiteType
|
return SiteType
|
||||||
if type(instance) == SiteGroup:
|
if type(instance) is SiteGroup:
|
||||||
return SiteGroupType
|
return SiteGroupType
|
||||||
|
@ -129,7 +129,7 @@ def add_available_vlans(vlans, vlan_group=None):
|
|||||||
})
|
})
|
||||||
|
|
||||||
vlans = list(vlans) + new_vlans
|
vlans = list(vlans) + new_vlans
|
||||||
vlans.sort(key=lambda v: v.vid if type(v) == VLAN else v['vid'])
|
vlans.sort(key=lambda v: v.vid if type(v) is VLAN else v['vid'])
|
||||||
|
|
||||||
return vlans
|
return vlans
|
||||||
|
|
||||||
|
@ -123,9 +123,9 @@ class BulkImportForm(BootstrapMixin, SyncedDataMixin, forms.Form):
|
|||||||
records = []
|
records = []
|
||||||
try:
|
try:
|
||||||
for data in yaml.load_all(data, Loader=yaml.SafeLoader):
|
for data in yaml.load_all(data, Loader=yaml.SafeLoader):
|
||||||
if type(data) == list:
|
if type(data) is list:
|
||||||
records.extend(data)
|
records.extend(data)
|
||||||
elif type(data) == dict:
|
elif type(data) is dict:
|
||||||
records.append(data)
|
records.append(data)
|
||||||
else:
|
else:
|
||||||
raise forms.ValidationError({
|
raise forms.ValidationError({
|
||||||
|
@ -114,7 +114,7 @@ def annotated_date(date_value):
|
|||||||
if not date_value:
|
if not date_value:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
if type(date_value) == datetime.date:
|
if type(date_value) is datetime.date:
|
||||||
long_ts = date(date_value, 'DATE_FORMAT')
|
long_ts = date(date_value, 'DATE_FORMAT')
|
||||||
short_ts = date(date_value, 'SHORT_DATE_FORMAT')
|
short_ts = date(date_value, 'SHORT_DATE_FORMAT')
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user