mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 05:21:55 -06:00
#15277: Clean up references to object types in templates
This commit is contained in:
parent
0419a69ae8
commit
0e89f46601
@ -209,7 +209,7 @@ class CustomField(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
objects = CustomFieldManager()
|
objects = CustomFieldManager()
|
||||||
|
|
||||||
clone_fields = (
|
clone_fields = (
|
||||||
'content_types', 'type', 'object_type', 'group_name', 'description', 'required', 'search_weight',
|
'object_types', 'type', 'object_type', 'group_name', 'description', 'required', 'search_weight',
|
||||||
'filter_logic', 'default', 'weight', 'validation_minimum', 'validation_maximum', 'validation_regex',
|
'filter_logic', 'default', 'weight', 'validation_minimum', 'validation_maximum', 'validation_regex',
|
||||||
'choice_set', 'ui_visible', 'ui_editable', 'is_cloneable',
|
'choice_set', 'ui_visible', 'ui_editable', 'is_cloneable',
|
||||||
)
|
)
|
||||||
|
@ -359,7 +359,7 @@ class CustomLink(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
clone_fields = (
|
clone_fields = (
|
||||||
'content_types', 'enabled', 'weight', 'group_name', 'button_class', 'new_window',
|
'object_types', 'enabled', 'weight', 'group_name', 'button_class', 'new_window',
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -448,7 +448,7 @@ class ExportTemplate(SyncedDataMixin, CloningMixin, ExportTemplatesMixin, Change
|
|||||||
)
|
)
|
||||||
|
|
||||||
clone_fields = (
|
clone_fields = (
|
||||||
'content_types', 'template_code', 'mime_type', 'file_extension', 'as_attachment',
|
'object_types', 'template_code', 'mime_type', 'file_extension', 'as_attachment',
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -561,7 +561,7 @@ class SavedFilter(CloningMixin, ExportTemplatesMixin, ChangeLoggedModel):
|
|||||||
)
|
)
|
||||||
|
|
||||||
clone_fields = (
|
clone_fields = (
|
||||||
'content_types', 'weight', 'enabled', 'parameters',
|
'object_types', 'weight', 'enabled', 'parameters',
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -314,7 +314,7 @@ class EventRuleTable(NetBoxTable):
|
|||||||
'last_updated',
|
'last_updated',
|
||||||
)
|
)
|
||||||
default_columns = (
|
default_columns = (
|
||||||
'pk', 'name', 'enabled', 'action_type', 'action_object', 'content_types', 'type_create', 'type_update',
|
'pk', 'name', 'enabled', 'action_type', 'action_object', 'object_types', 'type_create', 'type_update',
|
||||||
'type_delete', 'type_job_start', 'type_job_end',
|
'type_delete', 'type_job_start', 'type_job_end',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -762,8 +762,8 @@ class ImageAttachmentEditView(generic.ObjectEditView):
|
|||||||
def alter_object(self, instance, request, args, kwargs):
|
def alter_object(self, instance, request, args, kwargs):
|
||||||
if not instance.pk:
|
if not instance.pk:
|
||||||
# Assign the parent object based on URL kwargs
|
# Assign the parent object based on URL kwargs
|
||||||
content_type = get_object_or_404(ContentType, pk=request.GET.get('content_type'))
|
object_type = get_object_or_404(ContentType, pk=request.GET.get('object_type'))
|
||||||
instance.parent = get_object_or_404(content_type.model_class(), pk=request.GET.get('object_id'))
|
instance.parent = get_object_or_404(object_type.model_class(), pk=request.GET.get('object_id'))
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
def get_return_url(self, request, obj=None):
|
def get_return_url(self, request, obj=None):
|
||||||
@ -771,7 +771,7 @@ class ImageAttachmentEditView(generic.ObjectEditView):
|
|||||||
|
|
||||||
def get_extra_addanother_params(self, request):
|
def get_extra_addanother_params(self, request):
|
||||||
return {
|
return {
|
||||||
'content_type': request.GET.get('content_type'),
|
'object_type': request.GET.get('object_type'),
|
||||||
'object_id': request.GET.get('object_id'),
|
'object_id': request.GET.get('object_id'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,6 @@
|
|||||||
|
|
||||||
{% block title %}{{ object.name }}{% endblock %}
|
{% block title %}{{ object.name }}{% endblock %}
|
||||||
|
|
||||||
{% block breadcrumbs %}
|
|
||||||
{{ block.super }}
|
|
||||||
<li class="breadcrumb-item"><a href="{% url 'extras:exporttemplate_list' %}?content_type={{ object.content_type.pk }}">{{ object.content_type }}</a></li>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col col-md-5">
|
<div class="col col-md-5">
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
{% trans "Images" %}
|
{% trans "Images" %}
|
||||||
{% if perms.extras.add_imageattachment %}
|
{% if perms.extras.add_imageattachment %}
|
||||||
<div class="card-actions">
|
<div class="card-actions">
|
||||||
<a href="{% url 'extras:imageattachment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
<a href="{% url 'extras:imageattachment_add' %}?object_type={{ object|content_type_id }}&object_id={{ object.pk }}" class="btn btn-ghost-primary btn-sm">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Attach an image" %}
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Attach an image" %}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{% block extra_controls %}
|
{% block extra_controls %}
|
||||||
{% if perms.tenancy.add_contactassignment %}
|
{% if perms.tenancy.add_contactassignment %}
|
||||||
{% with viewname=object|viewname:"contacts" %}
|
{% with viewname=object|viewname:"contacts" %}
|
||||||
<a href="{% url 'tenancy:contactassignment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={% url viewname pk=object.pk %}" class="btn btn-primary">
|
<a href="{% url 'tenancy:contactassignment_add' %}?object_type={{ object|content_type_id }}&object_id={{ object.pk }}&return_url={% url viewname pk=object.pk %}" class="btn btn-primary">
|
||||||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a contact" %}
|
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {% trans "Add a contact" %}
|
||||||
</a>
|
</a>
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
Loading…
Reference in New Issue
Block a user