mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Define __all__ for models.py within each app
This commit is contained in:
parent
26a257b794
commit
6959785cd1
@ -12,6 +12,14 @@ from utilities.utils import serialize_object
|
||||
from .choices import *
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Circuit',
|
||||
'CircuitTermination',
|
||||
'CircuitType',
|
||||
'Provider',
|
||||
)
|
||||
|
||||
|
||||
class Provider(ChangeLoggedModel, CustomFieldModel):
|
||||
"""
|
||||
Each Circuit belongs to a Provider. This is usually a telecommunications company or similar organization. This model
|
||||
|
@ -19,6 +19,26 @@ from .constants import *
|
||||
from .querysets import ConfigContextQuerySet
|
||||
|
||||
|
||||
__all__ = (
|
||||
'ConfigContext',
|
||||
'ConfigContextModel',
|
||||
'CustomField',
|
||||
'CustomFieldChoice',
|
||||
'CustomFieldModel',
|
||||
'CustomFieldValue',
|
||||
'CustomLink',
|
||||
'ExportTemplate',
|
||||
'Graph',
|
||||
'ImageAttachment',
|
||||
'ObjectChange',
|
||||
'ReportResult',
|
||||
'Script',
|
||||
'Tag',
|
||||
'TaggedItem',
|
||||
'Webhook',
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Webhooks
|
||||
#
|
||||
|
11
netbox/ipam/constants.py
Normal file
11
netbox/ipam/constants.py
Normal file
@ -0,0 +1,11 @@
|
||||
from .choices import IPAddressRoleChoices
|
||||
|
||||
IPADDRESS_ROLES_NONUNIQUE = (
|
||||
# IPAddress roles which are exempt from unique address enforcement
|
||||
IPAddressRoleChoices.ROLE_ANYCAST,
|
||||
IPAddressRoleChoices.ROLE_VIP,
|
||||
IPAddressRoleChoices.ROLE_VRRP,
|
||||
IPAddressRoleChoices.ROLE_HSRP,
|
||||
IPAddressRoleChoices.ROLE_GLBP,
|
||||
IPAddressRoleChoices.ROLE_CARP,
|
||||
)
|
@ -15,6 +15,7 @@ from utilities.models import ChangeLoggedModel
|
||||
from utilities.utils import serialize_object
|
||||
from virtualization.models import VirtualMachine
|
||||
from .choices import *
|
||||
from .constants import IPADDRESS_ROLES_NONUNIQUE
|
||||
from .fields import IPNetworkField, IPAddressField
|
||||
from .querysets import PrefixQuerySet
|
||||
from .validators import DNSValidator
|
||||
@ -26,14 +27,17 @@ AF_CHOICES = (
|
||||
(6, 'IPv6'),
|
||||
)
|
||||
|
||||
IPADDRESS_ROLES_NONUNIQUE = (
|
||||
# IPAddress roles which are exempt from unique address enforcement
|
||||
IPAddressRoleChoices.ROLE_ANYCAST,
|
||||
IPAddressRoleChoices.ROLE_VIP,
|
||||
IPAddressRoleChoices.ROLE_VRRP,
|
||||
IPAddressRoleChoices.ROLE_HSRP,
|
||||
IPAddressRoleChoices.ROLE_GLBP,
|
||||
IPAddressRoleChoices.ROLE_CARP,
|
||||
|
||||
__all__ = (
|
||||
'Aggregate',
|
||||
'IPAddress',
|
||||
'Prefix',
|
||||
'RIR',
|
||||
'Role',
|
||||
'Service',
|
||||
'VLAN',
|
||||
'VLANGroup',
|
||||
'VRF',
|
||||
)
|
||||
|
||||
|
||||
|
@ -21,6 +21,14 @@ from .hashers import SecretValidationHasher
|
||||
from .querysets import UserKeyQuerySet
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Secret',
|
||||
'SecretRole',
|
||||
'SessionKey',
|
||||
'UserKey',
|
||||
)
|
||||
|
||||
|
||||
def generate_random_key(bits=256):
|
||||
"""
|
||||
Generate a random encryption key. Sizes is given in bits and must be in increments of 32.
|
||||
|
@ -7,6 +7,12 @@ from extras.models import CustomFieldModel, TaggedItem
|
||||
from utilities.models import ChangeLoggedModel
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Tenant',
|
||||
'TenantGroup',
|
||||
)
|
||||
|
||||
|
||||
class TenantGroup(ChangeLoggedModel):
|
||||
"""
|
||||
An arbitrary collection of Tenants.
|
||||
|
@ -7,6 +7,11 @@ from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Token',
|
||||
)
|
||||
|
||||
|
||||
class Token(models.Model):
|
||||
"""
|
||||
An API token used for user authentication. This extends the stock model to allow each user to have multiple tokens.
|
||||
|
@ -4,6 +4,11 @@ from extras.models import ObjectChange
|
||||
from utilities.utils import serialize_object
|
||||
|
||||
|
||||
__all__ = (
|
||||
'ChangeLoggedModel',
|
||||
)
|
||||
|
||||
|
||||
class ChangeLoggedModel(models.Model):
|
||||
"""
|
||||
An abstract model which adds fields to store the creation and last-updated times for an object. Both fields can be
|
||||
|
@ -11,6 +11,14 @@ from utilities.models import ChangeLoggedModel
|
||||
from .choices import *
|
||||
|
||||
|
||||
__all__ = (
|
||||
'Cluster',
|
||||
'ClusterGroup',
|
||||
'ClusterType',
|
||||
'VirtualMachine',
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Cluster types
|
||||
#
|
||||
|
@ -1,3 +1,4 @@
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.test import TestCase
|
||||
|
||||
from virtualization.models import *
|
||||
|
Loading…
Reference in New Issue
Block a user