Skip to content

Conversation

@markkuleinio
Copy link
Contributor

Fixes: #8398

Adds ConfigParam.size attribute that can be used for enlarging the text input field for specific configuration parameters.

Also adds size="80" for those parameters that seems to benefit from longer input field.

Unfortunately my Django skills did not allow for using textareas for the banner fields, it was not a simple field=forms.Textarea change as it resulted as TypeError: __init__() got an unexpected keyword argument 'required' in

param_fields[param.name] = param.field(**field_kwargs)

🤔

@jeremystretch
Copy link
Member

jeremystretch commented Feb 7, 2022

Rather than restricting the available parameter to a specific size (which doesn't even apply to most form widgets), IMO it would be preferable to allow the specification of a widget instance with arbitrary parameters. For the banners specifically, I would expect we'd use Django's Textarea widget rather than just increasing the size of the TextInput.

Edit: Actually, this is already possible using the field_kwargs attribute:

    ConfigParam(
        name='BANNER_LOGIN',
        label='Login banner',
        default='',
        description="Additional content to display on the login page",
        field_kwargs={
            'widget': forms.Textarea()
        }
    ),

Screenshot 2022-02-07 at 10-30-13 Add config revision NetBox

Copy link
Member

@jeremystretch jeremystretch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per my comment here, we don't need to add a size attribute: We can just specify the widget to employ in field_kwargs for the relevant fields.

@jeremystretch jeremystretch merged commit c0a65eb into netbox-community:develop Feb 10, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 19, 2022
@markkuleinio markkuleinio deleted the 8398-field-sizes branch December 22, 2023 06:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Banner edit fields should be larger

2 participants