diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2011-04-01 16:10:22 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2011-04-01 16:10:22 +0000 |
| commit | 94af19c43fad3e42d64981e22fe15b844f1f9eb6 (patch) | |
| tree | ed67e78446f376d0429cbd045500540676222f78 /docs/ref/forms | |
| parent | 7099d465abad0e6fd7c5ff096dc8ab55c14ecfdd (diff) | |
Changed e-mail to email throughout documentation and codebase. The one exception is translation strings, which I didn't want to disrupt
git-svn-id: http://code.djangoproject.com/svn/django/trunk@15967 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'docs/ref/forms')
| -rw-r--r-- | docs/ref/forms/api.txt | 22 | ||||
| -rw-r--r-- | docs/ref/forms/fields.txt | 16 | ||||
| -rw-r--r-- | docs/ref/forms/validation.txt | 10 |
3 files changed, 24 insertions, 24 deletions
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt index 81544ca2b5..bd8948cc08 100644 --- a/docs/ref/forms/api.txt +++ b/docs/ref/forms/api.txt @@ -89,11 +89,11 @@ and return a boolean designating whether the data was valid:: Let's try with some invalid data. In this case, ``subject`` is blank (an error, because all fields are required by default) and ``sender`` is not a valid -e-mail address:: +email address:: >>> data = {'subject': '', ... 'message': 'Hi there', - ... 'sender': 'invalid e-mail address', + ... 'sender': 'invalid email address', ... 'cc_myself': True} >>> f = ContactForm(data) >>> f.is_valid() @@ -105,7 +105,7 @@ Access the :attr:`~Form.errors` attribute to get a dictionary of error messages:: >>> f.errors - {'sender': [u'Enter a valid e-mail address.'], 'subject': [u'This field is required.']} + {'sender': [u'Enter a valid email address.'], 'subject': [u'This field is required.']} In this dictionary, the keys are the field names, and the values are lists of Unicode strings representing the error messages. The error messages are stored @@ -204,7 +204,7 @@ If your data does *not* validate, your ``Form`` instance will not have a >>> data = {'subject': '', ... 'message': 'Hi there', - ... 'sender': 'invalid e-mail address', + ... 'sender': 'invalid email address', ... 'cc_myself': True} >>> f = ContactForm(data) >>> f.is_valid() @@ -531,25 +531,25 @@ method you're using:: >>> data = {'subject': '', ... 'message': 'Hi there', - ... 'sender': 'invalid e-mail address', + ... 'sender': 'invalid email address', ... 'cc_myself': True} >>> f = ContactForm(data, auto_id=False) >>> print f.as_table() <tr><th>Subject:</th><td><ul class="errorlist"><li>This field is required.</li></ul><input type="text" name="subject" maxlength="100" /></td></tr> <tr><th>Message:</th><td><input type="text" name="message" value="Hi there" /></td></tr> - <tr><th>Sender:</th><td><ul class="errorlist"><li>Enter a valid e-mail address.</li></ul><input type="text" name="sender" value="invalid e-mail address" /></td></tr> + <tr><th>Sender:</th><td><ul class="errorlist"><li>Enter a valid email address.</li></ul><input type="text" name="sender" value="invalid email address" /></td></tr> <tr><th>Cc myself:</th><td><input checked="checked" type="checkbox" name="cc_myself" /></td></tr> >>> print f.as_ul() <li><ul class="errorlist"><li>This field is required.</li></ul>Subject: <input type="text" name="subject" maxlength="100" /></li> <li>Message: <input type="text" name="message" value="Hi there" /></li> - <li><ul class="errorlist"><li>Enter a valid e-mail address.</li></ul>Sender: <input type="text" name="sender" value="invalid e-mail address" /></li> + <li><ul class="errorlist"><li>Enter a valid email address.</li></ul>Sender: <input type="text" name="sender" value="invalid email address" /></li> <li>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></li> >>> print f.as_p() <p><ul class="errorlist"><li>This field is required.</li></ul></p> <p>Subject: <input type="text" name="subject" maxlength="100" /></p> <p>Message: <input type="text" name="message" value="Hi there" /></p> - <p><ul class="errorlist"><li>Enter a valid e-mail address.</li></ul></p> - <p>Sender: <input type="text" name="sender" value="invalid e-mail address" /></p> + <p><ul class="errorlist"><li>Enter a valid email address.</li></ul></p> + <p>Sender: <input type="text" name="sender" value="invalid email address" /></p> <p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p> Customizing the error list format @@ -571,8 +571,8 @@ pass that in at construction time:: <div class="errorlist"><div class="error">This field is required.</div></div> <p>Subject: <input type="text" name="subject" maxlength="100" /></p> <p>Message: <input type="text" name="message" value="Hi there" /></p> - <div class="errorlist"><div class="error">Enter a valid e-mail address.</div></div> - <p>Sender: <input type="text" name="sender" value="invalid e-mail address" /></p> + <div class="errorlist"><div class="error">Enter a valid email address.</div></div> + <p>Sender: <input type="text" name="sender" value="invalid email address" /></p> <p>Cc myself: <input checked="checked" type="checkbox" name="cc_myself" /></p> More granular output diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index b49864f7cf..73d8b02869 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -27,10 +27,10 @@ exception or returns the clean value:: u'foo@example.com' >>> f.clean(u'foo@example.com') u'foo@example.com' - >>> f.clean('invalid e-mail address') + >>> f.clean('invalid email address') Traceback (most recent call last): ... - ValidationError: [u'Enter a valid e-mail address.'] + ValidationError: [u'Enter a valid email address.'] Core field arguments -------------------- @@ -208,23 +208,23 @@ fields. We've specified ``auto_id=False`` to simplify the output:: >>> class HelpTextContactForm(forms.Form): ... subject = forms.CharField(max_length=100, help_text='100 characters max.') ... message = forms.CharField() - ... sender = forms.EmailField(help_text='A valid e-mail address, please.') + ... sender = forms.EmailField(help_text='A valid email address, please.') ... cc_myself = forms.BooleanField(required=False) >>> f = HelpTextContactForm(auto_id=False) >>> print f.as_table() <tr><th>Subject:</th><td><input type="text" name="subject" maxlength="100" /><br /><span class="helptext">100 characters max.</span></td></tr> <tr><th>Message:</th><td><input type="text" name="message" /></td></tr> - <tr><th>Sender:</th><td><input type="text" name="sender" /><br />A valid e-mail address, please.</td></tr> + <tr><th>Sender:</th><td><input type="text" name="sender" /><br />A valid email address, please.</td></tr> <tr><th>Cc myself:</th><td><input type="checkbox" name="cc_myself" /></td></tr> >>> print f.as_ul() <li>Subject: <input type="text" name="subject" maxlength="100" /> <span class="helptext">100 characters max.</span></li> <li>Message: <input type="text" name="message" /></li> - <li>Sender: <input type="text" name="sender" /> A valid e-mail address, please.</li> + <li>Sender: <input type="text" name="sender" /> A valid email address, please.</li> <li>Cc myself: <input type="checkbox" name="cc_myself" /></li> >>> print f.as_p() <p>Subject: <input type="text" name="subject" maxlength="100" /> <span class="helptext">100 characters max.</span></p> <p>Message: <input type="text" name="message" /></p> - <p>Sender: <input type="text" name="sender" /> A valid e-mail address, please.</p> + <p>Sender: <input type="text" name="sender" /> A valid email address, please.</p> <p>Cc myself: <input type="checkbox" name="cc_myself" /></p> ``error_messages`` @@ -481,7 +481,7 @@ Takes four optional arguments: * Default widget: ``TextInput`` * Empty value: ``''`` (an empty string) * Normalizes to: A Unicode object. - * Validates that the given value is a valid e-mail address, using a + * Validates that the given value is a valid email address, using a moderately complex regular expression. * Error message keys: ``required``, ``invalid`` @@ -490,7 +490,7 @@ If provided, these arguments ensure that the string is at most or at least the given length. .. versionchanged:: 1.2 - The EmailField previously did not recognize e-mail addresses as valid that + The EmailField previously did not recognize email addresses as valid that contained an IDN (Internationalized Domain Name; a domain containing unicode characters) domain part. This has now been corrected. diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt index d5f40706a1..d8f896deb2 100644 --- a/docs/ref/forms/validation.txt +++ b/docs/ref/forms/validation.txt @@ -77,7 +77,7 @@ overridden: * The Form subclass's ``clean()`` method. This method can perform any validation that requires access to multiple fields from the form at once. This is where you might put in things to check that if field ``A`` - is supplied, field ``B`` must contain a valid e-mail address and the + is supplied, field ``B`` must contain a valid email address and the like. The data that this method returns is the final ``cleaned_data`` attribute for the form, so don't forget to return the full list of cleaned data if you override this method (by default, ``Form.clean()`` @@ -187,12 +187,12 @@ a look at Django's ``EmailField``:: class EmailField(CharField): default_error_messages = { - 'invalid': _(u'Enter a valid e-mail address.'), + 'invalid': _(u'Enter a valid email address.'), } default_validators = [validators.validate_email] As you can see, ``EmailField`` is just a ``CharField`` with customized error -message and a validator that validates e-mail addresses. This can also be done +message and a validator that validates email addresses. This can also be done on field definition so:: email = forms.EmailField() @@ -200,14 +200,14 @@ on field definition so:: is equivalent to:: email = forms.CharField(validators=[validators.validate_email], - error_messages={'invalid': _(u'Enter a valid e-mail address.')}) + error_messages={'invalid': _(u'Enter a valid email address.')}) Form field default cleaning ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Let's firstly create a custom form field that validates its input is a string -containing comma-separated e-mail addresses. The full class looks like this:: +containing comma-separated email addresses. The full class looks like this:: from django import forms from django.core.validators import validate_email |
