I\'m a Django newbie.
I\'d like to restrict user to use a specific domain (e.g. @gmail.com ) to sign up my Django website, but how to customize the EmailField in my
You can achieve the same via HTML5 input tag attribute (pattern). Say for example your domain is foo.com, then the code will be:
Also you can change the error message by using the setCustomValidity of the DOM element.
document.getElementById('email').setCustomValidity("Please use an @foo.com email address.");