people typing in IDs in wrong format ( not \d{4} with leading 0)
People typing in the same person twice, with new ID.
It would be good to check for the first two,
check for duplicate IDs or auto assign the trp ID by checking for the highest number (not the number of entries, in case of deletion).
I'm not sure we can do much about the third one, other than make sure no one changes the trp ID without doing some checking first. That may be documentation.
Duplicate IDs is not a problem, django throws a warning because the field is indicated as unique, auto assignment of id's already happens
For formatting, the format is now automatically changed to be correct.
If, after re-formatting the ID then becomes a duplicate, django does not throw a nice warning in the interface, but I catch the Integrity Error thrown from the DB and don't let the duplicate value save. A next step would be to do better error reporting to the user in this case
we have three problems:
It would be good to check for the first two,
I'm not sure we can do much about the third one, other than make sure no one changes the trp ID without doing some checking first. That may be documentation.