Correct use of custom fields in reports #2963

Closed
opened 2025-12-29 18:24:05 +01:00 by adam · 3 comments
Owner

Originally created by @wols on GitHub (Oct 18, 2019).

Change Type

[x] Addition
[ ] Correction
[ ] Deprecation
[ ] Cleanup (formatting, typos, etc.)

Proposed Changes

Please add an example for the correct use of current custom fields in Reports - Netbox

E.g check boolean custom_field for unset|true|false...

Originally created by @wols on GitHub (Oct 18, 2019). ### Change Type [x] Addition [ ] Correction [ ] Deprecation [ ] Cleanup (formatting, typos, etc.) ### Proposed Changes Please add an example for the correct use of current custom fields in [Reports - Netbox](https://netbox.readthedocs.io/en/stable/additional-features/reports/) E.g check boolean `custom_field` for `unset|true|false`...
adam closed this issue 2025-12-29 18:24:05 +01:00
Author
Owner

@kobayashi commented on GitHub (Oct 20, 2019):

Hello @wols,
Thank you for taking your time for this issue. Are you interested in making the PR to add the part to the docs?

@kobayashi commented on GitHub (Oct 20, 2019): Hello @wols, Thank you for taking your time for this issue. Are you interested in making the PR to add the part to the docs?
Author
Owner

@wols commented on GitHub (Oct 22, 2019):

Sure - but the issue was triggered by ignorance:

Python version: 3.6.9
NetBox version: 2.6.6

from dcim.models import Device
from extras.models import CustomFieldValue

My first test...

for device in Device.objects.all():
    test = CustomFieldValue.objects.filter(obj_id=device.id)
    if test:
        self.log_info(
            device,
            "custom_fields on {} : {}".format(device.name, test)
        )

...any results - but What the right way to filter for a boolean CustomField my_field?

@wols commented on GitHub (Oct 22, 2019): Sure - but the issue was triggered by ignorance: Python version: 3.6.9 NetBox version: 2.6.6 ``` from dcim.models import Device from extras.models import CustomFieldValue ``` My first test... ``` for device in Device.objects.all(): test = CustomFieldValue.objects.filter(obj_id=device.id) if test: self.log_info( device, "custom_fields on {} : {}".format(device.name, test) ) ``` ...any results - but **What the right way to filter for a boolean CustomField `my_field`?**
Author
Owner

@jeremystretch commented on GitHub (Oct 23, 2019):

@wols Please post to the mailing list if you need assistance with reports.

@jeremystretch commented on GitHub (Oct 23, 2019): @wols Please post to the mailing list if you need assistance with reports.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#2963