Display enhancement for Custom field. #1963

Closed
opened 2025-12-29 17:20:58 +01:00 by adam · 2 comments
Owner

Originally created by @a31amit on GitHub (Aug 22, 2018).

Environment

  • Python version: 3.4.x
  • NetBox version: 2.4.3

Proposed Functionality

Functionality or True/False bit on custom field which allow them to show in device page section or hide from there. But Show all of them in inventory tab section.

I believe this way it can become more useful.

Use Case

Custom fields are great in netbox and can be used for many things. Also these can be increase signifcantly due to user wanted information in netbox which is even not advisable. However It would be great if there could have a Display flag on custom field so it show on /dcim/device/id device page if display flag is enabled but all of custom fields showed under inventory tab with custom field section below to Chassis section.

We are using custom field for various information not every information in custom field is needed when someone open a device page. But they are useful sometimes when someone needed detailed information about device.

Example -
I have these 5 custom fields -

these are needed some point but not regularly. we calucalte a depreciation on device based on these dates and update end of life status which is TRUE/FALSE

Device Manfacture Date
First Production Date
Last reprovision Date
End of Life Date
End of Life Status

So End of life status and end of life date can be showed in Device Page but all other custom field can be showed into inventory tab, down below chassis section. it makes device home page much clean and nicer while using custom fields too.

Database Changes

Not sure at about this, I believe a true/false flag needed so that templates render them based on it.
This would be requires to change html template.

External Dependencies

None

Originally created by @a31amit on GitHub (Aug 22, 2018). <!-- NOTE: This form is only for proposing specific new features or enhancements. If you have a general idea or question, please post to our mailing list instead of opening an issue: https://groups.google.com/forum/#!forum/netbox-discuss NOTE: Due to an excessive backlog of feature requests, we are not currently accepting any proposals which significantly extend NetBox's feature scope. Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report. --> ### Environment * Python version: 3.4.x * NetBox version: 2.4.3 <!-- Describe in detail the new functionality you are proposing. Include any specific changes to work flows, data models, or the user interface. --> ### Proposed Functionality Functionality or True/False bit on custom field which allow them to show in device page section or hide from there. But Show all of them in inventory tab section. I believe this way it can become more useful. <!-- Convey an example use case for your proposed feature. Write from the perspective of a NetBox user who would benefit from the proposed functionality and describe how. ---> ### Use Case Custom fields are great in netbox and can be used for many things. Also these can be increase signifcantly due to user wanted information in netbox which is even not advisable. However It would be great if there could have a Display flag on custom field so it show on /dcim/device/id device page if display flag is enabled but all of custom fields showed under inventory tab with custom field section below to Chassis section. We are using custom field for various information not every information in custom field is needed when someone open a device page. But they are useful sometimes when someone needed detailed information about device. Example - I have these 5 custom fields - these are needed some point but not regularly. we calucalte a depreciation on device based on these dates and update end of life status which is TRUE/FALSE Device Manfacture Date First Production Date Last reprovision Date End of Life Date End of Life Status So End of life status and end of life date can be showed in Device Page but all other custom field can be showed into inventory tab, down below chassis section. it makes device home page much clean and nicer while using custom fields too. <!-- Note any changes to the database schema necessary to support the new feature. For example, does the proposal require adding a new model or field? (Not all new features require database changes.) ---> ### Database Changes Not sure at about this, I believe a true/false flag needed so that templates render them based on it. This would be requires to change html template. <!-- List any new dependencies on external libraries or services that this new feature would introduce. For example, does the proposal require the installation of a new Python package? (Not all new features introduce new dependencies.) --> ### External Dependencies None
adam added the status: duplicate label 2025-12-29 17:20:58 +01:00
adam closed this issue 2025-12-29 17:20:58 +01:00
Author
Owner

@Bill-Irvine commented on GitHub (Aug 22, 2018):

Something simple that might help in the mean time.

I've changed the 'custom_fields_panel.html' template to only display used custom fields when viewing the device. This means you can fill out separate fields for different types of devices and it will only display the relevant ones.

{% for field, value in custom_fields.items %}
	**{% if value is not None  %}**
                <tr>
                    <td>{{ field }}</td>
                    <td>
                        {% if field.type == 300 and value == True %}
                            <i class="glyphicon glyphicon-ok text-success" title="True"></i>
                        {% elif field.type == 300 and value == False %}
                            <i class="glyphicon glyphicon-remove text-danger" title="False"></i>
                        {% elif field.type == 500 and value %}
                            <a href="{{ value }}">{{ value|truncatechars:70 }}</a>
                        {% elif field.type == 200 or value %}
                            {{ value }}
                        {% elif field.required %}
                            <span class="text-warning">Not defined</span>
                        {% else %}
                            <span class="text-muted">N/A</span>
                        {% endif %}
                    </td>
                </tr>
	**{% endif %}**
{% endfor %}
@Bill-Irvine commented on GitHub (Aug 22, 2018): Something simple that might help in the mean time. I've changed the 'custom_fields_panel.html' template to only display used custom fields when viewing the device. This means you can fill out separate fields for different types of devices and it will only display the relevant ones. ``` {% for field, value in custom_fields.items %} **{% if value is not None %}** <tr> <td>{{ field }}</td> <td> {% if field.type == 300 and value == True %} <i class="glyphicon glyphicon-ok text-success" title="True"></i> {% elif field.type == 300 and value == False %} <i class="glyphicon glyphicon-remove text-danger" title="False"></i> {% elif field.type == 500 and value %} <a href="{{ value }}">{{ value|truncatechars:70 }}</a> {% elif field.type == 200 or value %} {{ value }} {% elif field.required %} <span class="text-warning">Not defined</span> {% else %} <span class="text-muted">N/A</span> {% endif %} </td> </tr> **{% endif %}** {% endfor %} ```
Author
Owner

@jeremystretch commented on GitHub (Aug 22, 2018):

Sounds like a duplicate of #2132

@jeremystretch commented on GitHub (Aug 22, 2018): Sounds like a duplicate of #2132
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1963