Skip to content

Commit

Permalink
Merge pull request #11219 from netbox-community/develop
Browse files Browse the repository at this point in the history
Release v3.4.1
  • Loading branch information
jeremystretch authored Dec 16, 2022
2 parents def3ccf + 0058c77 commit 27c71b8
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.4.0
placeholder: v3.4.1
validations:
required: true
- type: dropdown
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.4.0
placeholder: v3.4.1
validations:
required: true
- type: dropdown
Expand Down
11 changes: 11 additions & 0 deletions docs/configuration/system.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@ BASE_PATH = 'netbox/'

---

## DEFAULT_LANGUAGE

Default: `en-us` (US English)

Defines the default preferred language/locale for requests that do not specify one. This is used to alter e.g. the display of dates and numbers to fit the user's locale. See [this list](http://www.i18nguy.com/unicode/language-identifiers.html) of standard language codes. (This parameter maps to Django's [`LANGUAGE_CODE`](https://docs.djangoproject.com/en/stable/ref/settings/#language-code) internal setting.)

!!! note
Altering this parameter will *not* change the language used in NetBox. We hope to provide translation support in a future NetBox release.

---

## DOCS_ROOT

Default: `$INSTALL_ROOT/docs/`
Expand Down
19 changes: 19 additions & 0 deletions docs/release-notes/version-3.4.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# NetBox v3.4

## v3.4.1 (2022-12-16)

### Enhancements

* [#9971](https://github.com/netbox-community/netbox/issues/9971) - Enable ordering of nested group models by name
* [#11214](https://github.com/netbox-community/netbox/issues/11214) - Introduce the `DEFAULT_LANGUAGE` configuration parameter

### Bug Fixes

* [#11175](https://github.com/netbox-community/netbox/issues/11175) - Fix cloning of fields containing special characters
* [#11178](https://github.com/netbox-community/netbox/issues/11178) - Pressing enter in quick search box should not trigger bulk operations
* [#11184](https://github.com/netbox-community/netbox/issues/11184) - Correct visualization of cable path which splits across multiple circuit terminations
* [#11185](https://github.com/netbox-community/netbox/issues/11185) - Fix TemplateSyntaxError when viewing custom script results
* [#11189](https://github.com/netbox-community/netbox/issues/11189) - Fix localization of dates & numbers
* [#11205](https://github.com/netbox-community/netbox/issues/11205) - Correct cloning behavior for recursively-nested models
* [#11206](https://github.com/netbox-community/netbox/issues/11206) - Avoid clearing assigned groups if `REMOTE_AUTH_DEFAULT_GROUPS` is invalid

---

## v3.4.0 (2022-12-14)

!!! warning "PostgreSQL 11 Required"
Expand Down
13 changes: 10 additions & 3 deletions netbox/dcim/models/cables.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,11 +567,12 @@ def from_origin(cls, terminations):

elif isinstance(remote_terminations[0], CircuitTermination):
# Follow a CircuitTermination to its corresponding CircuitTermination (A to Z or vice versa)
term_side = remote_terminations[0].term_side
assert all(ct.term_side == term_side for ct in remote_terminations[1:])
if len(remote_terminations) > 1:
is_split = True
break
circuit_termination = CircuitTermination.objects.filter(
circuit=remote_terminations[0].circuit,
term_side='Z' if term_side == 'A' else 'A'
term_side='Z' if remote_terminations[0].term_side == 'A' else 'A'
).first()
if circuit_termination is None:
break
Expand Down Expand Up @@ -685,6 +686,7 @@ def get_split_nodes(self):
"""
Return all available next segments in a split cable path.
"""
from circuits.models import CircuitTermination
nodes = self.path_objects[-1]

# RearPort splitting to multiple FrontPorts with no stack position
Expand All @@ -694,3 +696,8 @@ def get_split_nodes(self):
# RearPorts connected to different cables
elif type(nodes[0]) is FrontPort:
return RearPort.objects.filter(pk__in=[fp.rear_port_id for fp in nodes])
# Cable terminating to multiple CircuitTerminations
elif type(nodes[0]) is CircuitTermination:
return [
ct.get_peer_termination() for ct in nodes
]
3 changes: 1 addition & 2 deletions netbox/netbox/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,5 +382,4 @@ def user_default_groups_handler(backend, user, response, *args, **kwargs):
if group_list:
user.groups.add(*group_list)
else:
user.groups.clear()
logger.debug(f"Stripping user {user} from Groups")
logger.info(f"No valid group assignments for {user} - REMOTE_AUTH_DEFAULT_GROUPS may be incorrectly set?")
3 changes: 3 additions & 0 deletions netbox/netbox/configuration_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
# on a production system.
DEBUG = False

# Set the default preferred language/locale
DEFAULT_LANGUAGE = 'en-us'

# Email settings
EMAIL = {
'SERVER': 'localhost',
Expand Down
2 changes: 1 addition & 1 deletion netbox/netbox/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class Meta:
abstract = True


class NestedGroupModel(NetBoxFeatureSet, MPTTModel):
class NestedGroupModel(CloningMixin, NetBoxFeatureSet, MPTTModel):
"""
Base model for objects which are used to form a hierarchy (regions, locations, etc.). These models nest
recursively using MPTT. Within each parent, each child instance must have a unique name.
Expand Down
7 changes: 3 additions & 4 deletions netbox/netbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
# Environment setup
#

VERSION = '3.4.0'
VERSION = '3.4.1'

# Hostname
HOSTNAME = platform.node()
Expand Down Expand Up @@ -94,6 +94,7 @@
HTTP_PROXIES = getattr(configuration, 'HTTP_PROXIES', None)
INTERNAL_IPS = getattr(configuration, 'INTERNAL_IPS', ('127.0.0.1', '::1'))
JINJA2_FILTERS = getattr(configuration, 'JINJA2_FILTERS', {})
LANGUAGE_CODE = getattr(configuration, 'DEFAULT_LANGUAGE', 'en-us')
LOGGING = getattr(configuration, 'LOGGING', {})
LOGIN_PERSISTENCE = getattr(configuration, 'LOGIN_PERSISTENCE', False)
LOGIN_REQUIRED = getattr(configuration, 'LOGIN_REQUIRED', False)
Expand Down Expand Up @@ -339,6 +340,7 @@ def _setting(name, default=None):
'django_prometheus.middleware.PrometheusBeforeMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
Expand Down Expand Up @@ -385,9 +387,6 @@ def _setting(name, default=None):
'netbox.authentication.ObjectPermissionBackend',
]

# Internationalization
LANGUAGE_CODE = 'en-us'

# Time zones
USE_TZ = True

Expand Down
5 changes: 3 additions & 2 deletions netbox/netbox/tables/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,14 +537,15 @@ class MPTTColumn(tables.TemplateColumn):
"""
template_code = """
{% load helpers %}
{% for i in record.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
{% if not table.order_by %}
{% for i in record.level|as_range %}<i class="mdi mdi-circle-small"></i>{% endfor %}
{% endif %}
<a href="{{ record.get_absolute_url }}">{{ record.name }}</a>
"""

def __init__(self, *args, **kwargs):
super().__init__(
template_code=self.template_code,
orderable=False,
attrs={'td': {'class': 'text-nowrap'}},
*args,
**kwargs
Expand Down
1 change: 1 addition & 0 deletions netbox/templates/extras/htmx/script_result.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{% load humanize %}
{% load helpers %}
{% load log_levels %}

Expand Down
6 changes: 3 additions & 3 deletions netbox/templates/generic/object_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@
{% applied_filters model filter_form request.GET %}
{% endif %}

{# Object table controls #}
{% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}

<form method="post" class="form form-horizontal">
{% csrf_token %}
{# "Select all" form #}
Expand All @@ -96,9 +99,6 @@
</div>
{% endif %}

{# Object table controls #}
{% include 'inc/table_controls_htmx.html' with table_modal="ObjectTable_config" %}

<div class="form form-horizontal">
{% csrf_token %}
<input type="hidden" name="return_url" value="{% if return_url %}{{ return_url }}{% else %}{{ request.path }}{% if request.GET %}?{{ request.GET.urlencode }}{% endif %}{% endif %}" />
Expand Down
3 changes: 2 additions & 1 deletion netbox/utilities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from extras.plugins import PluginConfig
from extras.utils import is_taggable
from netbox.config import get_config
from urllib.parse import urlencode
from utilities.constants import HTTP_REQUEST_META_SAFE_COPY


Expand Down Expand Up @@ -353,7 +354,7 @@ def prepare_cloned_fields(instance):
params.append((key, ''))

# Return a QueryDict with the parameters
return QueryDict('&'.join([f'{k}={v}' for k, v in params]), mutable=True)
return QueryDict(urlencode(params), mutable=True)


def shallow_compare_dict(source_dict, destination_dict, exclude=None):
Expand Down

0 comments on commit 27c71b8

Please sign in to comment.