Compare commits

...

13 Commits

Author SHA1 Message Date
Ryan Gillespie 61ae5c8009
Merge 10c1419df2 into d606cf1b3c 2024-04-22 15:04:20 -05:00
Jeremy Stretch d606cf1b3c Update source translations 2024-04-22 15:50:38 -04:00
Jeremy Stretch 0b0dab42eb PRVB 2024-04-22 12:23:31 -04:00
Jeremy Stretch d115601da3
Merge pull request #15805 from netbox-community/develop
Release v3.7.6
2024-04-22 12:18:27 -04:00
Jeremy Stretch a61e20849b Release v3.7.6 2024-04-22 11:46:03 -04:00
Arthur Hanson 1eca1c3d17
15803 localize help_text (#15804) 2024-04-22 11:42:20 -04:00
transifex-integration[bot] 5d95d49268
Update translations 2024-04-22 11:28:04 -04:00
Jeremy Stretch 6b8bfe9947 Changelog for #14690, #15541, #15588, #15761, #15771, #15790 2024-04-22 11:25:21 -04:00
Jeremy Stretch e87877b6ea Fixes #15771: Show id field as supported on all bulk import forms 2024-04-22 11:08:36 -04:00
Jeremy Stretch ebe504c825 Closes #15664: Restore usage of READTHEDOCS env variable 2024-04-22 09:52:03 -04:00
Markku Leiniö b6e38b2ebe
Closes #14690: Pretty-format JSON fields in the config form (#15623)
* Closes #14690: Pretty-format JSON fields in the config form

* Revert changes

* Use our own JSONField for config parameters for pretty editor outputs

* Compare identity instead of equality
2024-04-22 09:25:16 -04:00
Ryan Gillespie 10c1419df2 Fixes #15717: Allow VM with Site to Cluster without Site 2024-04-18 03:29:08 +00:00
Ryan Gillespie c4209addc4 Fixes #15717: Allow VM with Site to Cluster without Site 2024-04-17 03:22:22 +00:00
23 changed files with 317 additions and 208 deletions

View File

@ -26,7 +26,7 @@ body:
attributes:
label: NetBox Version
description: What version of NetBox are you currently running?
placeholder: v3.7.5
placeholder: v3.7.6
validations:
required: true
- type: dropdown

View File

@ -14,7 +14,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.7.5
placeholder: v3.7.6
validations:
required: true
- type: dropdown

View File

@ -61,7 +61,8 @@ django-timezone-field
# A REST API framework for Django projects
# https://www.django-rest-framework.org/community/release-notes/
djangorestframework
# Pinned to 3.14 for NetBox v3.7
djangorestframework<3.15
# Sane and flexible OpenAPI 3 schema generation for Django REST framework.
# https://github.com/tfranzel/drf-spectacular/blob/master/CHANGELOG.rst

View File

@ -2,8 +2,8 @@
{% block site_meta %}
{{ super() }}
{# Disable search indexing unless we're building for ReadTheDocs (see #10496) #}
{% if page.canonical_url != 'https://docs.netbox.dev/' %}
{# Disable search indexing unless we're building for ReadTheDocs #}
{% if not config.extra.readthedocs %}
<meta name="robots" content="noindex">
{% endif %}
{% endblock %}

View File

@ -62,7 +62,7 @@ class MyModelImportForm(NetBoxModelImportForm):
site = CSVModelChoiceField(
queryset=Site.objects.all(),
to_field_name='name',
help_text='Assigned site'
help_text=_('Assigned site')
)
class Meta:

View File

@ -1,20 +1,30 @@
# NetBox v3.7
## v3.7.6 (FUTURE)
## v3.7.7 (FUTURE)
---
## v3.7.6 (2024-04-22)
### Enhancements
* [#14690](https://github.com/netbox-community/netbox/issues/14690) - Improve rendering of JSON data in configuration form
* [#15427](https://github.com/netbox-community/netbox/issues/15427) - Enable compatibility with non-Amazon S3 providers for remote data sources
* [#15640](https://github.com/netbox-community/netbox/issues/15640) - Add global search support for L2VPN identifiers
* [#15644](https://github.com/netbox-community/netbox/issues/15644) - Introduce new configuration parameters for enabling HTTP Strict Transport Security (HSTS)
### Bug Fixes
* [#15541](https://github.com/netbox-community/netbox/issues/15541) - Restore ability to modify assigned component template when adding/modifying an inventory item template
* [#15582](https://github.com/netbox-community/netbox/issues/15582) - Fix permission constraints for synchronization of remote data sources
* [#15588](https://github.com/netbox-community/netbox/issues/15588) - Correct OpenAPI schema definitions for read-only fields which may return null values
* [#15635](https://github.com/netbox-community/netbox/issues/15635) - Extend plugin removal instruction to include reindexing the global search cache
* [#15654](https://github.com/netbox-community/netbox/issues/15654) - Fix `AttributeError` exception when attempting to save an incomplete tunnel termination
* [#15668](https://github.com/netbox-community/netbox/issues/15668) - Fix permission required to display virtual disks tab on virtual machine UI view
* [#15685](https://github.com/netbox-community/netbox/issues/15685) - Allow filtering cables by decimal values using UI filter form
* [#15761](https://github.com/netbox-community/netbox/issues/15761) - Add missing `ike_policy` & `ike_policy_id` filters for IKE proposals
* [#15771](https://github.com/netbox-community/netbox/issues/15771) - Include `id` in list of supported fields for all bulk import forms
* [#15790](https://github.com/netbox-community/netbox/issues/15790) - Fix live preview support for EventRule comments
---

View File

@ -42,6 +42,7 @@ plugins:
show_root_toc_entry: false
show_source: false
extra:
readthedocs: !ENV READTHEDOCS
social:
- icon: fontawesome/brands/github
link: https://github.com/netbox-community/netbox

View File

@ -3,6 +3,7 @@ import json
from django import forms
from django.conf import settings
from django.forms.fields import JSONField as _JSONField
from django.utils.translation import gettext_lazy as _
from core.forms.mixins import SyncedDataMixin
@ -12,7 +13,7 @@ from netbox.forms import NetBoxModelForm
from netbox.registry import registry
from netbox.utils import get_data_backend_choices
from utilities.forms import BootstrapMixin, get_field_value
from utilities.forms.fields import CommentField
from utilities.forms.fields import CommentField, JSONField
from utilities.forms.widgets import HTMXSelect
__all__ = (
@ -132,6 +133,9 @@ class ConfigFormMetaclass(forms.models.ModelFormMetaclass):
'help_text': param.description,
}
field_kwargs.update(**param.field_kwargs)
if param.field is _JSONField:
# Replace with our own JSONField to get pretty JSON in config editor
param.field = JSONField
param_fields[param.name] = param.field(**field_kwargs)
attrs.update(param_fields)

View File

@ -668,7 +668,7 @@ class DeviceSerializer(NetBoxModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name='dcim-api:device-detail')
device_type = NestedDeviceTypeSerializer()
role = NestedDeviceRoleSerializer()
device_role = NestedDeviceRoleSerializer(read_only=True, help_text='Deprecated in v3.6 in favor of `role`.')
device_role = NestedDeviceRoleSerializer(read_only=True, help_text=_('Deprecated in v3.6 in favor of `role`.'))
tenant = NestedTenantSerializer(required=False, allow_null=True, default=None)
platform = NestedPlatformSerializer(required=False, allow_null=True)
site = NestedSiteSerializer()

View File

@ -1373,14 +1373,14 @@ class VirtualDeviceContextImportForm(NetBoxModelImportForm):
label=_('Device'),
queryset=Device.objects.all(),
to_field_name='name',
help_text='Assigned role'
help_text=_('Assigned role')
)
tenant = CSVModelChoiceField(
label=_('Tenant'),
queryset=Tenant.objects.all(),
required=False,
to_field_name='name',
help_text='Assigned tenant'
help_text=_('Assigned tenant')
)
status = CSVChoiceField(
label=_('Status'),

View File

@ -8,6 +8,7 @@ from dcim.models import *
from extras.models import CustomField
from tenancy.models import Tenant
from utilities.utils import drange
from virtualization.models import Cluster, ClusterType
class LocationTestCase(TestCase):
@ -533,6 +534,36 @@ class DeviceTestCase(TestCase):
device2.full_clean()
device2.save()
def test_device_mismatched_site_cluster(self):
cluster_type = ClusterType.objects.create(name='Cluster Type 1', slug='cluster-type-1')
Cluster.objects.create(name='Cluster 1', type=cluster_type)
sites = (
Site(name='Site 1', slug='site-1'),
Site(name='Site 2', slug='site-2'),
)
Site.objects.bulk_create(sites)
clusters = (
Cluster(name='Cluster 1', type=cluster_type, site=sites[0]),
Cluster(name='Cluster 2', type=cluster_type, site=sites[1]),
Cluster(name='Cluster 3', type=cluster_type, site=None),
)
Cluster.objects.bulk_create(clusters)
device_type = DeviceType.objects.first()
device_role = DeviceRole.objects.first()
# Device with site only should pass
Device(name='device1', site=sites[0], device_type=device_type, role=device_role).full_clean()
# Device with site, cluster non-site should pass
Device(name='device1', site=sites[0], device_type=device_type, role=device_role, cluster=clusters[2]).full_clean()
# Device with mismatched site & cluster should fail
with self.assertRaises(ValidationError):
Device(name='device1', site=sites[0], device_type=device_type, role=device_role, cluster=clusters[1]).full_clean()
def test_old_device_role_field(self):
"""
Ensure that the old device role field sets the value in the new role field.

View File

@ -73,17 +73,12 @@ class NetBoxModelImportForm(CSVModelForm, NetBoxModelForm):
"""
Base form for creating a NetBox objects from CSV data. Used for bulk importing.
"""
id = forms.IntegerField(
label=_('Id'),
required=False,
help_text='Numeric ID of an existing object to update (if not creating a new object)'
)
tags = CSVModelMultipleChoiceField(
label=_('Tags'),
queryset=Tag.objects.all(),
required=False,
to_field_name='slug',
help_text='Tag slugs separated by commas, encased with double quotes (e.g. "tag1,tag2,tag3")'
help_text=_('Tag slugs separated by commas, encased with double quotes (e.g. "tag1,tag2,tag3")')
)
def _get_custom_fields(self, content_type):

View File

@ -28,7 +28,7 @@ from netbox.plugins import PluginConfig
# Environment setup
#
VERSION = '3.7.6-dev'
VERSION = '3.7.7-dev'
# Hostname
HOSTNAME = platform.node()

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
# Translators:
# Jonathan Senecal, 2024
# Jeremy Stretch, 2024
# Quentin Laurent, 2024
#
#, fuzzy
msgid ""
@ -14,7 +15,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-04 19:11+0000\n"
"PO-Revision-Date: 2023-10-30 17:48+0000\n"
"Last-Translator: Jeremy Stretch, 2024\n"
"Last-Translator: Quentin Laurent, 2024\n"
"Language-Team: French (https://app.transifex.com/netbox-community/teams/178115/fr/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -3716,7 +3717,7 @@ msgstr "Réservation"
#: dcim/forms/model_forms.py:301 dcim/forms/model_forms.py:384
#: utilities/forms/fields/fields.py:47
msgid "Slug"
msgstr "limace"
msgstr "Identifiant"
#: dcim/forms/model_forms.py:308 templates/dcim/devicetype.html:12
msgid "Chassis"
@ -5813,7 +5814,7 @@ msgstr "Poids maximum"
#: ipam/tables/asn.py:66 netbox/navigation/menu.py:16
#: netbox/navigation/menu.py:18
msgid "Sites"
msgstr "Des sites"
msgstr "Sites"
#: dcim/tests/test_api.py:49
msgid "Test case must set peer_termination_type"
@ -13355,7 +13356,7 @@ msgstr ""
#: utilities/forms/fields/fields.py:48
msgid "URL-friendly unique shorthand"
msgstr "Raccourci unique et convivial pour les URL"
msgstr "Identifiant unique utilisable dans les URL"
#: utilities/forms/fields/fields.py:101
msgid "Enter context data in <a href=\"https://json.org/\">JSON</a> format."

View File

@ -5,8 +5,8 @@
#
# Translators:
# Tatsuya Ueda <ml@tatsuya.info>, 2024
# teapot, 2024
# Jeremy Stretch, 2024
# teapot, 2024
#
#, fuzzy
msgid ""
@ -15,7 +15,7 @@ msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-04-04 19:11+0000\n"
"PO-Revision-Date: 2023-10-30 17:48+0000\n"
"Last-Translator: Jeremy Stretch, 2024\n"
"Last-Translator: teapot, 2024\n"
"Language-Team: Japanese (https://app.transifex.com/netbox-community/teams/178115/ja/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -7681,7 +7681,7 @@ msgstr "プレフィックス内およびプレフィックスを含む"
#: ipam/filtersets.py:259
msgid "Prefixes which contain this prefix or IP"
msgstr "このプレフィックスまたは IP を含むプレフィックス"
msgstr "このプレフィックス / IP を含むプレフィックス"
#: ipam/filtersets.py:270 ipam/filtersets.py:538 ipam/forms/bulk_edit.py:326
#: ipam/forms/filtersets.py:191 ipam/forms/filtersets.py:317
@ -7700,11 +7700,11 @@ msgstr "VLAN 番号 (1-4094)"
#: ipam/forms/model_forms.py:430 templates/tenancy/contact.html:54
#: tenancy/forms/bulk_edit.py:112
msgid "Address"
msgstr "住所"
msgstr "アドレス"
#: ipam/filtersets.py:445
msgid "Ranges which contain this prefix or IP"
msgstr "このプレフィックスまたは IP を含む範囲"
msgstr "このプレフィックス / IP を含む範囲"
#: ipam/filtersets.py:473 ipam/filtersets.py:529
msgid "Parent prefix"
@ -7743,11 +7743,11 @@ msgstr "FHRP グループ (ID)"
#: ipam/filtersets.py:618
msgid "Is assigned to an interface"
msgstr "インタフェースに割り当てられている"
msgstr "インタフェースに割り当てられている"
#: ipam/filtersets.py:622
msgid "Is assigned"
msgstr "割り当てられている"
msgstr "割当済みか"
#: ipam/filtersets.py:1047
msgid "IP address (ID)"
@ -7881,7 +7881,7 @@ msgstr "子 VLAN VID の最小値"
#: ipam/forms/bulk_edit.py:420
msgid "Maximum child VLAN VID"
msgstr "子 VLAN VID の最大"
msgstr "子 VLAN VID の最大"
#: ipam/forms/bulk_edit.py:428 ipam/forms/model_forms.py:531
msgid "Scope type"
@ -7905,11 +7905,11 @@ msgstr "ポート"
#: ipam/forms/bulk_import.py:47
msgid "Import route targets"
msgstr "ルートターゲットをインポート"
msgstr "インポートルートターゲット"
#: ipam/forms/bulk_import.py:53
msgid "Export route targets"
msgstr "ルートターゲットをエクスポートする"
msgstr "エクスポートルートターゲット"
#: ipam/forms/bulk_import.py:91 ipam/forms/bulk_import.py:111
#: ipam/forms/bulk_import.py:131

View File

@ -70,6 +70,12 @@ class CSVModelForm(forms.ModelForm):
"""
ModelForm used for the import of objects in CSV format.
"""
id = forms.IntegerField(
label=_('ID'),
required=False,
help_text=_('Numeric ID of an existing object to update (if not creating a new object)')
)
def __init__(self, *args, headers=None, **kwargs):
self.headers = headers or {}
super().__init__(*args, **kwargs)

View File

@ -178,7 +178,7 @@ class VirtualMachine(ContactsMixin, RenderConfigMixin, ConfigContextModel, Prima
})
# Validate site for cluster & device
if self.cluster and self.site and self.cluster.site != self.site:
if self.cluster and self.cluster.site is not None and self.cluster.site != self.site:
raise ValidationError({
'cluster': _(
'The selected cluster ({cluster}) is not assigned to this site ({site}).'

View File

@ -63,6 +63,9 @@ class VirtualMachineTestCase(TestCase):
# VM with site only should pass
VirtualMachine(name='vm1', site=sites[0]).full_clean()
# VM with site, cluster non-site should pass
VirtualMachine(name='vm1', site=sites[0], cluster=clusters[2]).full_clean()
# VM with non-site cluster only should pass
VirtualMachine(name='vm1', cluster=clusters[2]).full_clean()

View File

@ -42,7 +42,7 @@ class WirelessLANImportForm(NetBoxModelImportForm):
status = CSVChoiceField(
label=_('Status'),
choices=WirelessLANStatusChoices,
help_text='Operational status'
help_text=_('Operational status')
)
vlan = CSVModelChoiceField(
label=_('VLAN'),

View File

@ -18,11 +18,11 @@ drf-spectacular==0.27.2
drf-spectacular-sidecar==2024.4.1
feedparser==6.0.11
graphene-django==3.0.0
gunicorn==21.2.0
gunicorn==22.0.0
Jinja2==3.1.3
Markdown==3.6
mkdocs-material==9.5.17
mkdocstrings[python-legacy]==0.24.2
mkdocs-material==9.5.18
mkdocstrings[python-legacy]==0.24.3
netaddr==1.2.1
Pillow==10.3.0
psycopg[binary,pool]==3.1.18