Environment
NetBox version: main
Steps to Reproduce
- Create any Custom Field of type Object or Multi-object and set a Related Object Type (e.g. select "IP Address" or any model from a plugin that uses an internal model name).
- Open the detail page for that Custom Field.
Expected Behavior
The Type field shows the human-readable verbose name, e.g. Object (IP Address) or Object (Cat).
Actual Behavior
The Type field shows the raw Django ContentType model name run through bettertitle, e.g.:
Object (Ipaddress) for IP Address (model name ipaddress)
Object (Table24model) for a model from the netbox-custom-objects plugin (whose dynamic models are named table<id>model)
Root Cause
templates/extras/customfield/attrs/type.html uses:
{{ object.related_object_type.model|bettertitle }}
ContentType.model is the raw lowercase model name (e.g. ipaddress, table24model). bettertitle only capitalises the first letter of each space-separated word, so single-word or programmatic names are not made human-readable.
ContentType.name is the correct property — it returns capfirst(model._meta.verbose_name) (e.g. IP address, Cat), falling back to model when the model class is not registered.
Fix
Change the template to use related_object_type.name instead of related_object_type.model:
{{ object.related_object_type.name|bettertitle }}
This also improves the display of existing NetBox models: IP Address currently renders as Ipaddress; with the fix it renders as IP Address.
Environment
NetBox version: main
Steps to Reproduce
Expected Behavior
The Type field shows the human-readable verbose name, e.g.
Object (IP Address)orObject (Cat).Actual Behavior
The Type field shows the raw Django ContentType model name run through
bettertitle, e.g.:Object (Ipaddress)for IP Address (model nameipaddress)Object (Table24model)for a model from the netbox-custom-objects plugin (whose dynamic models are namedtable<id>model)Root Cause
templates/extras/customfield/attrs/type.htmluses:ContentType.modelis the raw lowercase model name (e.g.ipaddress,table24model).bettertitleonly capitalises the first letter of each space-separated word, so single-word or programmatic names are not made human-readable.ContentType.nameis the correct property — it returnscapfirst(model._meta.verbose_name)(e.g.IP address,Cat), falling back tomodelwhen the model class is not registered.Fix
Change the template to use
related_object_type.nameinstead ofrelated_object_type.model:This also improves the display of existing NetBox models: IP Address currently renders as
Ipaddress; with the fix it renders asIP Address.