mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 10:16:42 -06:00
Fixes #8398: Add ConfigParam.size to enlarge specific config fields
This commit is contained in:
parent
aff55881df
commit
05e8fff458
@ -25,6 +25,8 @@ class FormMetaclass(forms.models.ModelFormMetaclass):
|
|||||||
}
|
}
|
||||||
field_kwargs.update(**param.field_kwargs)
|
field_kwargs.update(**param.field_kwargs)
|
||||||
param_fields[param.name] = param.field(**field_kwargs)
|
param_fields[param.name] = param.field(**field_kwargs)
|
||||||
|
if param.size:
|
||||||
|
param_fields[param.name].widget.attrs["size"] = param.size
|
||||||
attrs.update(param_fields)
|
attrs.update(param_fields)
|
||||||
|
|
||||||
return super().__new__(mcs, name, bases, attrs)
|
return super().__new__(mcs, name, bases, attrs)
|
||||||
|
@ -4,13 +4,14 @@ from django.contrib.postgres.forms import SimpleArrayField
|
|||||||
|
|
||||||
class ConfigParam:
|
class ConfigParam:
|
||||||
|
|
||||||
def __init__(self, name, label, default, description='', field=None, field_kwargs=None):
|
def __init__(self, name, label, default, description='', field=None, field_kwargs=None, size=None):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.label = label
|
self.label = label
|
||||||
self.default = default
|
self.default = default
|
||||||
self.field = field or forms.CharField
|
self.field = field or forms.CharField
|
||||||
self.description = description
|
self.description = description
|
||||||
self.field_kwargs = field_kwargs or {}
|
self.field_kwargs = field_kwargs or {}
|
||||||
|
self.size = size
|
||||||
|
|
||||||
|
|
||||||
PARAMS = (
|
PARAMS = (
|
||||||
@ -20,19 +21,22 @@ PARAMS = (
|
|||||||
name='BANNER_LOGIN',
|
name='BANNER_LOGIN',
|
||||||
label='Login banner',
|
label='Login banner',
|
||||||
default='',
|
default='',
|
||||||
description="Additional content to display on the login page"
|
description="Additional content to display on the login page",
|
||||||
|
size="80",
|
||||||
),
|
),
|
||||||
ConfigParam(
|
ConfigParam(
|
||||||
name='BANNER_TOP',
|
name='BANNER_TOP',
|
||||||
label='Top banner',
|
label='Top banner',
|
||||||
default='',
|
default='',
|
||||||
description="Additional content to display at the top of every page"
|
description="Additional content to display at the top of every page",
|
||||||
|
size="80",
|
||||||
),
|
),
|
||||||
ConfigParam(
|
ConfigParam(
|
||||||
name='BANNER_BOTTOM',
|
name='BANNER_BOTTOM',
|
||||||
label='Bottom banner',
|
label='Bottom banner',
|
||||||
default='',
|
default='',
|
||||||
description="Additional content to display at the bottom of every page"
|
description="Additional content to display at the bottom of every page",
|
||||||
|
size="80",
|
||||||
),
|
),
|
||||||
|
|
||||||
# IPAM
|
# IPAM
|
||||||
@ -77,7 +81,8 @@ PARAMS = (
|
|||||||
),
|
),
|
||||||
description="Permitted schemes for URLs in user-provided content",
|
description="Permitted schemes for URLs in user-provided content",
|
||||||
field=SimpleArrayField,
|
field=SimpleArrayField,
|
||||||
field_kwargs={'base_field': forms.CharField()}
|
field_kwargs={'base_field': forms.CharField()},
|
||||||
|
size="80",
|
||||||
),
|
),
|
||||||
|
|
||||||
# Pagination
|
# Pagination
|
||||||
@ -157,7 +162,8 @@ PARAMS = (
|
|||||||
name='MAPS_URL',
|
name='MAPS_URL',
|
||||||
label='Maps URL',
|
label='Maps URL',
|
||||||
default='https://maps.google.com/?q=',
|
default='https://maps.google.com/?q=',
|
||||||
description="Base URL for mapping geographic locations"
|
description="Base URL for mapping geographic locations",
|
||||||
|
size="80",
|
||||||
),
|
),
|
||||||
|
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user