1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #7809: Add missing export template support for various models

This commit is contained in:
jeremystretch
2021-11-11 16:16:54 -05:00
parent a799094227
commit 0b705553a5
5 changed files with 8 additions and 7 deletions

View File

@ -20,6 +20,7 @@
* [#7788](https://github.com/netbox-community/netbox/issues/7788) - Improve XSS mitigation in Markdown renderer * [#7788](https://github.com/netbox-community/netbox/issues/7788) - Improve XSS mitigation in Markdown renderer
* [#7791](https://github.com/netbox-community/netbox/issues/7791) - Enable sorting device bays table by installed device status * [#7791](https://github.com/netbox-community/netbox/issues/7791) - Enable sorting device bays table by installed device status
* [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table * [#7802](https://github.com/netbox-community/netbox/issues/7802) - Differentiate ID and VID columns in VLANs table
* [#7809](https://github.com/netbox-community/netbox/issues/7809) - Add missing export template support for various models
--- ---

View File

@ -70,7 +70,7 @@ class CustomLinkForm(BootstrapMixin, forms.ModelForm):
class ExportTemplateForm(BootstrapMixin, forms.ModelForm): class ExportTemplateForm(BootstrapMixin, forms.ModelForm):
content_type = ContentTypeChoiceField( content_type = ContentTypeChoiceField(
queryset=ContentType.objects.all(), queryset=ContentType.objects.all(),
limit_choices_to=FeatureQuery('custom_links') limit_choices_to=FeatureQuery('export_templates')
) )
class Meta: class Meta:

View File

@ -31,7 +31,7 @@ class CustomFieldManager(models.Manager.from_queryset(RestrictedQuerySet)):
return self.get_queryset().filter(content_types=content_type) return self.get_queryset().filter(content_types=content_type)
@extras_features('webhooks') @extras_features('webhooks', 'export_templates')
class CustomField(ChangeLoggedModel): class CustomField(ChangeLoggedModel):
content_types = models.ManyToManyField( content_types = models.ManyToManyField(
to=ContentType, to=ContentType,

View File

@ -9,7 +9,7 @@ from django.db import models
from django.http import HttpResponse from django.http import HttpResponse
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from django.utils.formats import date_format, time_format from django.utils.formats import date_format
from rest_framework.utils.encoders import JSONEncoder from rest_framework.utils.encoders import JSONEncoder
from extras.choices import * from extras.choices import *
@ -36,7 +36,7 @@ __all__ = (
# Webhooks # Webhooks
# #
@extras_features('webhooks') @extras_features('webhooks', 'export_templates')
class Webhook(ChangeLoggedModel): class Webhook(ChangeLoggedModel):
""" """
A Webhook defines a request that will be sent to a remote application when an object is created, updated, and/or A Webhook defines a request that will be sent to a remote application when an object is created, updated, and/or
@ -175,7 +175,7 @@ class Webhook(ChangeLoggedModel):
# Custom links # Custom links
# #
@extras_features('webhooks') @extras_features('webhooks', 'export_templates')
class CustomLink(ChangeLoggedModel): class CustomLink(ChangeLoggedModel):
""" """
A custom link to an external representation of a NetBox object. The link text and URL fields accept Jinja2 template A custom link to an external representation of a NetBox object. The link text and URL fields accept Jinja2 template
@ -234,7 +234,7 @@ class CustomLink(ChangeLoggedModel):
# Export templates # Export templates
# #
@extras_features('webhooks') @extras_features('webhooks', 'export_templates')
class ExportTemplate(ChangeLoggedModel): class ExportTemplate(ChangeLoggedModel):
content_type = models.ForeignKey( content_type = models.ForeignKey(
to=ContentType, to=ContentType,

View File

@ -14,7 +14,7 @@ from utilities.querysets import RestrictedQuerySet
# Tags # Tags
# #
@extras_features('webhooks') @extras_features('webhooks', 'export_templates')
class Tag(ChangeLoggedModel, TagBase): class Tag(ChangeLoggedModel, TagBase):
color = ColorField( color = ColorField(
default=ColorChoices.COLOR_GREY default=ColorChoices.COLOR_GREY