mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Fixes #7690: Fix custom field integer support for MultiValueNumberFilter
This commit is contained in:
parent
326a6be91c
commit
ee6e2e0af1
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
* [#5869](https://github.com/netbox-community/netbox/issues/5869) - Fix permissions evaluation under available prefix/IP REST API endpoints
|
* [#5869](https://github.com/netbox-community/netbox/issues/5869) - Fix permissions evaluation under available prefix/IP REST API endpoints
|
||||||
* [#7519](https://github.com/netbox-community/netbox/issues/7519) - Return a 409 status for unfulfillable available prefix/IP requests
|
* [#7519](https://github.com/netbox-community/netbox/issues/7519) - Return a 409 status for unfulfillable available prefix/IP requests
|
||||||
|
* [#7690](https://github.com/netbox-community/netbox/issues/7690) - Fix custom field integer support for MultiValueNumberFilter
|
||||||
* [#7990](https://github.com/netbox-community/netbox/issues/7990) - Fix `title` display on contact detail view
|
* [#7990](https://github.com/netbox-community/netbox/issues/7990) - Fix `title` display on contact detail view
|
||||||
* [#7996](https://github.com/netbox-community/netbox/issues/7996) - Show WWN field in interface creation form
|
* [#7996](https://github.com/netbox-community/netbox/issues/7996) - Show WWN field in interface creation form
|
||||||
* [#8001](https://github.com/netbox-community/netbox/issues/8001) - Correct verbose name for wireless LAN group model
|
* [#8001](https://github.com/netbox-community/netbox/issues/8001) - Correct verbose name for wireless LAN group model
|
||||||
|
@ -17,9 +17,10 @@ def multivalue_field_factory(field_class):
|
|||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
if not value:
|
if not value:
|
||||||
return []
|
return []
|
||||||
|
field = field_class()
|
||||||
return [
|
return [
|
||||||
# Only append non-empty values (this avoids e.g. trying to cast '' as an integer)
|
# Only append non-empty values (this avoids e.g. trying to cast '' as an integer)
|
||||||
super(field_class, self).to_python(v) for v in value if v
|
field.to_python(v) for v in value if v
|
||||||
]
|
]
|
||||||
|
|
||||||
return type('MultiValue{}'.format(field_class.__name__), (NewField,), dict())
|
return type('MultiValue{}'.format(field_class.__name__), (NewField,), dict())
|
||||||
@ -50,15 +51,15 @@ class MultiValueTimeFilter(django_filters.MultipleChoiceFilter):
|
|||||||
|
|
||||||
|
|
||||||
class MACAddressFilter(django_filters.CharFilter):
|
class MACAddressFilter(django_filters.CharFilter):
|
||||||
field_class = MACAddressField
|
pass
|
||||||
|
|
||||||
|
|
||||||
class MultiValueMACAddressFilter(django_filters.MultipleChoiceFilter):
|
class MultiValueMACAddressFilter(django_filters.MultipleChoiceFilter):
|
||||||
field_class = multivalue_field_factory(MACAddressField)
|
field_class = multivalue_field_factory(forms.CharField)
|
||||||
|
|
||||||
|
|
||||||
class MultiValueWWNFilter(django_filters.MultipleChoiceFilter):
|
class MultiValueWWNFilter(django_filters.MultipleChoiceFilter):
|
||||||
field_class = multivalue_field_factory(MACAddressField)
|
field_class = multivalue_field_factory(forms.CharField)
|
||||||
|
|
||||||
|
|
||||||
class TreeNodeMultipleChoiceFilter(django_filters.ModelMultipleChoiceFilter):
|
class TreeNodeMultipleChoiceFilter(django_filters.ModelMultipleChoiceFilter):
|
||||||
|
Loading…
Reference in New Issue
Block a user