mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 11:56:25 -06:00
Misc cleanup
This commit is contained in:
parent
45f29de89f
commit
a0c069d880
@ -124,7 +124,7 @@ COMPATIBLE_TERMINATION_TYPES = {
|
||||
'rearport': ['consoleport', 'consoleserverport', 'interface', 'frontport', 'rearport', 'circuittermination'],
|
||||
}
|
||||
|
||||
# models values for ContentTypes which may be Cluster scope types
|
||||
# Models which can serve to scope an object by location
|
||||
LOCATION_SCOPE_TYPES = (
|
||||
'region', 'sitegroup', 'site', 'location',
|
||||
)
|
||||
|
@ -15,6 +15,7 @@ from utilities.forms.widgets import HTMXSelect
|
||||
__all__ = (
|
||||
'ScopedBulkEditForm',
|
||||
'ScopedForm',
|
||||
'ScopedImportForm',
|
||||
)
|
||||
|
||||
|
||||
@ -95,6 +96,7 @@ class ScopedBulkEditForm(forms.Form):
|
||||
except ObjectDoesNotExist:
|
||||
pass
|
||||
|
||||
|
||||
class ScopedImportForm(forms.Form):
|
||||
scope_type = CSVContentTypeField(
|
||||
queryset=ContentType.objects.filter(model__in=LOCATION_SCOPE_TYPES),
|
||||
|
@ -35,10 +35,9 @@ class RenderConfigMixin(models.Model):
|
||||
|
||||
class CachedScopeMixin(models.Model):
|
||||
"""
|
||||
Mixin for adding a GFK Scope to a model that can point to a Region, SiteGroup, Site, or Location. Includes
|
||||
cached fields for each to allow efficient filtering. Must do any appropriate validation in the clean method
|
||||
as this does not have any as validation is generally model specific.
|
||||
|
||||
Mixin for adding a GenericForeignKey scope to a model that can point to a Region, SiteGroup, Site, or Location.
|
||||
Includes cached fields for each to allow efficient filtering. Appropriate validation must be done in the clean()
|
||||
method as this does not have any as validation is generally model-specific.
|
||||
"""
|
||||
scope_type = models.ForeignKey(
|
||||
to='contenttypes.ContentType',
|
||||
|
@ -39,8 +39,12 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Site" %}</th>
|
||||
<td>{{ object.site|linkify|placeholder }}</td>
|
||||
<th scope="row">{% trans "Scope" %}</th>
|
||||
{% if object.scope %}
|
||||
<td>{{ object.scope|linkify }} ({% trans object.scope_type.name %})</td>
|
||||
{% else %}
|
||||
<td>{{ ''|placeholder }}</td>
|
||||
{% endif %}
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user