-
Notifications
You must be signed in to change notification settings - Fork 2
fix: prevent source and language name overflow #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
…prevent overflow ref #455
5f68a4a to
553fe13
Compare
|
I agreed with you in the issue that this would be a display problem... why not save the entire source name though and truncate it for display, perhaps using a truncate template tag |
|
Thank you, I will do that instead. But don't we need some kind of a |
Do you mean in terms of a database constraint? You could use a text field... or put a max character that's really generous? |
|
The max length of a CharField is 255 characters.
In general you should choose a length that will serve the purpose, but not so long that people are tempted to write their life's story in the field. "The piano my grandmother gave me when I was ten and which I have many fond memories of" is not a suitable title, so if you truncate it to something reasonable then that removes this temptation. Django should raise a ValidationError if a user tries to save the field over the max length, so there is no risk of silently corrupting the user input. Personally, I would suggest shorter is better than longer since you want to encourage succinctness in naming. |
|
I wonder what the max length of names currently in DB is? Seems like a good gut check of where that field might max out. In either case, this limit should be transparent to user who should then be forced to truncate. Although source isn't particularly well-defined, I'd argue if we can't fit a standard-ish academic citation we need to rethink. Perhaps such a citation isn't a source "name", and this is a limitation of the current basic Source model. In any case, I'd be fine, for the present, with modifying this to force the user to provide a valid-length string, rather than truncating. |
Ah, yes; I agree, that looks like someone didn't enter them as separate labels... I just fixed both of those on Wikidata. |
- change the instrument source max lenght to 255 - force user to have instrument name under 60 and source under 255
… rendering sources
efaa1c6 to
f34f32e
Compare
- reduce the size of the language input to have everything shown in one row - reword source overflow error

Source input in AddName form:

Instrument detail for long sources:


ref #455