From 94af19c43fad3e42d64981e22fe15b844f1f9eb6 Mon Sep 17 00:00:00 2001
From: Adrian Holovaty Subject:
- Message:
+ Sender: Sender:
>>> print f.as_ul()
Cc myself:
Subject:
Sender:
Sender:
Subject:
Message:
-Sender:
+Sender:
Cc myself:
Customizing the error list format @@ -571,8 +571,8 @@ pass that in at construction time::Subject:
Message:
-Sender:
+Sender:
Cc myself:
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()Subject: 100 characters max.
Message:
-Sender: A valid e-mail address, please.
+Sender: A valid email address, please.
Cc myself:
``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 -- cgit v1.3