Add/factor out validation of aliases#3863
Merged
johannaengland merged 4 commits intoUninett:masterfrom Mar 18, 2026
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3863 +/- ##
==========================================
+ Coverage 63.69% 63.70% +0.01%
==========================================
Files 624 624
Lines 46106 46125 +19
Branches 43 43
==========================================
+ Hits 29366 29383 +17
- Misses 16730 16732 +2
Partials 10 10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
31e18af to
8322f26
Compare
Simrayz
requested changes
Mar 17, 2026
Contributor
Simrayz
left a comment
There was a problem hiding this comment.
Overall this is pretty good work! I think it makes sense to put the validation function in the forms module. Tests seem to have solid coverage of edge cases, nice.
The only strictly required change imo is to add a test for the pipe character invalidation. The other nits/suggestions are just cleanup.
8ddc753 to
c2b05ef
Compare
c2b05ef to
01e05a3
Compare
|
johannaengland
added a commit
to johannaengland/nav
that referenced
this pull request
Mar 18, 2026
The validation method was added in Uninett#3863
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.




Scope and purpose
Fixes #3852.
I was uncertain where to put the validation function, so I put it with the forms, but open for better suggestions!
I wish I could have just added a
cleanmethod toRoomandLocation, but DRF does not call that method anymore when validating (https://www.django-rest-framework.org/community/3.0-announcement/#differences-between-modelserializer-validation-and-modelform), so the API would have anyway had to explicitly call the validation.How to test:
Go to
/seeddb/location/add///seeddb/room/add/and try to create a room/location with an alias containing the pipe character.Try to create a location/room with an alias containing the pipe character via the API:
Contributor Checklist
Every pull request should have this checklist filled out, no matter how small it is.
More information about contributing to NAV can be found in the
Hacker's guide to NAV.
<major>.<minor>.x). For a new feature or other additions, it should be based onmaster.