Closes #21209: Support real model names in configuration parameters #482

Closed
opened 2026-04-05 16:35:12 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @adionit7 on 1/23/2026

Summary

This PR adds support for real model names (e.g., dcim.Site) in DEFAULT_DASHBOARD, CUSTOM_VALIDATORS, and PROTECTION_RULES configuration parameters, matching the syntax used by FIELD_CHOICES.

Changes:

  • Add normalize_model_identifier() utility function to convert real model names to lowercase format used by ObjectType
  • Update get_models_from_content_types() in dashboard widgets to normalize model identifiers
  • Update CUSTOM_VALIDATORS and PROTECTION_RULES lookups to check both real model names and lowercase names
  • Update documentation with real model name examples and backward compatibility notes

Backward Compatibility

Both formats are supported:

  • Real model names: dcim.Site, ipam.IPAddress
  • Lowercase names: dcim.site, ipam.ipaddress (existing behavior preserved)

Fixes #21209

*Originally created by @adionit7 on 1/23/2026* ## Summary This PR adds support for real model names (e.g., `dcim.Site`) in `DEFAULT_DASHBOARD`, `CUSTOM_VALIDATORS`, and `PROTECTION_RULES` configuration parameters, matching the syntax used by `FIELD_CHOICES`. ### Changes: - Add `normalize_model_identifier()` utility function to convert real model names to lowercase format used by ObjectType - Update `get_models_from_content_types()` in dashboard widgets to normalize model identifiers - Update `CUSTOM_VALIDATORS` and `PROTECTION_RULES` lookups to check both real model names and lowercase names - Update documentation with real model name examples and backward compatibility notes ### Backward Compatibility Both formats are supported: - Real model names: `dcim.Site`, `ipam.IPAddress` - Lowercase names: `dcim.site`, `ipam.ipaddress` (existing behavior preserved) Fixes #21209
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/netbox#482