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

Merge v3.1.9

This commit is contained in:
jeremystretch
2022-03-07 10:55:30 -05:00
19 changed files with 217 additions and 97 deletions

View File

@@ -94,7 +94,9 @@ class BulkRenameForm(BootstrapMixin, forms.Form):
An extendable form to be used for renaming objects in bulk.
"""
find = forms.CharField()
replace = forms.CharField()
replace = forms.CharField(
required=False
)
use_regex = forms.BooleanField(
required=False,
initial=True,

View File

@@ -39,6 +39,12 @@ class RestrictedQuerySet(QuerySet):
# Any permission with null constraints grants access to _all_ instances
attrs = Q()
break
else:
# for else, when no break
# avoid duplicates when JOIN on many-to-many fields without using DISTINCT.
# DISTINCT acts globally on the entire request, which may not be desirable.
allowed_objects = self.model.objects.filter(attrs)
attrs = Q(pk__in=allowed_objects)
qs = self.filter(attrs)
return qs