Skip to content

Conversation

@arthanson
Copy link
Collaborator

Fixes: #12468

Disallow double-underscore in custom field names. Unfortunately creates a migration, Jeremy what is the official way to suppress this migration?

@arthanson arthanson requested a review from jeremystretch May 8, 2023 15:59
@jeremystretch
Copy link
Member

For model field changes that don't actually modify the database schema (such as modifying application-level validators as in this case), we can just tweak the most recent definition of the field in the existing migrations. This happens to be 0066_customfield_name_validation.

Also: Rather than modifying the existing regex, it might be cleaner to add a second regex validator to check specifically for double underscores. This will allow us to use simpler expressions and to provide separate error messages to the user.

@arthanson
Copy link
Collaborator Author

@jeremystretch updated.

@jeremystretch jeremystretch merged commit 21f4761 into develop May 12, 2023
@jeremystretch jeremystretch deleted the 12468-custom-field-name branch May 12, 2023 20:09
jsenecal pushed a commit to jsenecal/netbox that referenced this pull request May 18, 2023
…nity#12523)

* 12468 disallow double underscores in custom field names

* 12468 disallow double underscores in custom field names

* 12468 review changes

* 12468 correct migration

* 12468 use inverse match

* 12468 use inverse match

* Add test for invalid custom field names

---------

Co-authored-by: jeremystretch <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disallow the use of double underscores in a custom field name

3 participants