I've read the Django documentation here: http://docs.djangoproject.com/en/dev/ref/forms/validation/
I've also browsed a number of search results on Google and Stack Overflow, but I haven't been able to answer my questions below.
As an example, say I have a model named "Widgets" with a CharField named "product_name". Now say that I want to restrict the allowable characters in "product_name" to [a-zA-Z0-9] plus apostrophes, dashes and underlines (i.e. ' - _) and show a form error to the user if they enter a restricted character.
From the above research, I gather that I need to create a validation function somewhere to check for these characters.
My specific questions:
1. What is best practice as to where a validation function like this should live in my Django project?
2. From where do I call this validation function?
3. How do I show an error to the user if a "bad" character is entered?
4. Would someone be so kind as to post a sample validation function?
Thank you, I appreciate any help you can provide.