Add custom field types for standardized location identifiers #7873

Closed
opened 2025-12-29 20:29:14 +01:00 by adam · 4 comments
Owner

Originally created by @jeremystretch on GitHub (Apr 6, 2023).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.4.7

Feature type

New functionality

Proposed functionality

Add three new types of custom field:

Custom fields of either type would render as selection fields listing only valid values as selectable options. These would be maintained within NetBox core, with no additional setup needed on the part of the administrator.

Use case

These are well-known values with a wide range of useful applications concerning the assignment of location data. For example, it is common practice to designate the LOCODE for each site on a network.

Database changes

N/A

External dependencies

There are a few ways we might source this data, such as the locode Python package. Further evaluation of the available options is needed.

Originally created by @jeremystretch on GitHub (Apr 6, 2023). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.4.7 ### Feature type New functionality ### Proposed functionality Add three new types of custom field: - [ISO 3166 country code](https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes) - [UN-LOCODE](https://unece.org/trade/cefact/unlocode-code-list-country-and-territory) - [IATA airport codes](https://en.wikipedia.org/wiki/IATA_airport_code) Custom fields of either type would render as selection fields listing only valid values as selectable options. These would be maintained within NetBox core, with no additional setup needed on the part of the administrator. ### Use case These are well-known values with a wide range of useful applications concerning the assignment of location data. For example, it is common practice to designate the LOCODE for each site on a network. ### Database changes N/A ### External dependencies There are a few ways we might source this data, such as the [locode Python package](https://pypi.org/project/locode/). Further evaluation of the available options is needed.
adam added the status: acceptedtype: feature labels 2025-12-29 20:29:14 +01:00
adam closed this issue 2025-12-29 20:29:15 +01:00
Author
Owner

@BarbarossaTM commented on GitHub (Apr 22, 2023):

This would be awesome, especially UN-LOCODE!

Do you have some idea in mind how to model this? Like for example would there be two levels for country and city?

@BarbarossaTM commented on GitHub (Apr 22, 2023): This would be awesome, especially UN-LOCODE! Do you have some idea in mind how to model this? Like for example would there be two levels for country and city?
Author
Owner

@jeremystretch commented on GitHub (Jun 23, 2023):

My initial thought here was to introduce new custom field types to hold the types of data mentioned above, but in retrospect that seems like a poor approach that won't scale well. Instead, I've just opened #12988 which proposes moving stored custom field choices into a separate model, which will allow for the efficient reuse of choice sets across multiple custom fields.

Marking this as blocked pending the acceptance of that proposal.

@jeremystretch commented on GitHub (Jun 23, 2023): My initial thought here was to introduce new custom field types to hold the types of data mentioned above, but in retrospect that seems like a poor approach that won't scale well. Instead, I've just opened #12988 which proposes moving stored custom field choices into a separate model, which will allow for the efficient reuse of choice sets across multiple custom fields. Marking this as blocked pending the acceptance of that proposal.
Author
Owner

@gdprdatasubect commented on GitHub (Jun 26, 2023):

Would it be possible to include NUTS1-3 for regions too?

@gdprdatasubect commented on GitHub (Jun 26, 2023): Would it be possible to include [NUTS1-3](https://en.wikipedia.org/wiki/Nomenclature_of_Territorial_Units_for_Statistics) for regions too?
Author
Owner

@jeremystretch commented on GitHub (Jul 19, 2023):

Another set to consider is CLLI.

@jeremystretch commented on GitHub (Jul 19, 2023): Another set to consider is [CLLI](https://en.wikipedia.org/wiki/CLLI_code).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7873