summaryrefslogtreecommitdiff
path: root/docs/ref/forms
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref/forms')
-rw-r--r--docs/ref/forms/fields.txt34
-rw-r--r--docs/ref/forms/validation.txt6
-rw-r--r--docs/ref/forms/widgets.txt15
3 files changed, 31 insertions, 24 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index c53d4f2e08..8f8d29e6f9 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -452,20 +452,20 @@ For each field, we describe the default widget used if you don't specify
If no ``input_formats`` argument is provided, the default input formats are::
['%Y-%m-%d', # '2006-10-25'
- '%m/%d/%Y', # '10/25/2006'
- '%m/%d/%y'] # '10/25/06'
+ '%m/%d/%Y', # '10/25/2006'
+ '%m/%d/%y'] # '10/25/06'
Additionally, if you specify :setting:`USE_L10N=False<USE_L10N>` in your settings, the
following will also be included in the default input formats::
['%b %d %Y', # 'Oct 25 2006'
- '%b %d, %Y', # 'Oct 25, 2006'
- '%d %b %Y', # '25 Oct 2006'
- '%d %b, %Y', # '25 Oct, 2006'
- '%B %d %Y', # 'October 25 2006'
- '%B %d, %Y', # 'October 25, 2006'
- '%d %B %Y', # '25 October 2006'
- '%d %B, %Y'] # '25 October, 2006'
+ '%b %d, %Y', # 'Oct 25, 2006'
+ '%d %b %Y', # '25 Oct 2006'
+ '%d %b, %Y', # '25 Oct, 2006'
+ '%B %d %Y', # 'October 25 2006'
+ '%B %d, %Y', # 'October 25, 2006'
+ '%d %B %Y', # '25 October 2006'
+ '%d %B, %Y'] # '25 October, 2006'
See also :ref:`format localization <format-localization>`.
@@ -491,14 +491,14 @@ For each field, we describe the default widget used if you don't specify
If no ``input_formats`` argument is provided, the default input formats are::
['%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
- '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
- '%Y-%m-%d', # '2006-10-25'
- '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
- '%m/%d/%Y %H:%M', # '10/25/2006 14:30'
- '%m/%d/%Y', # '10/25/2006'
- '%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
- '%m/%d/%y %H:%M', # '10/25/06 14:30'
- '%m/%d/%y'] # '10/25/06'
+ '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
+ '%Y-%m-%d', # '2006-10-25'
+ '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
+ '%m/%d/%Y %H:%M', # '10/25/2006 14:30'
+ '%m/%d/%Y', # '10/25/2006'
+ '%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
+ '%m/%d/%y %H:%M', # '10/25/06 14:30'
+ '%m/%d/%y'] # '10/25/06'
See also :ref:`format localization <format-localization>`.
diff --git a/docs/ref/forms/validation.txt b/docs/ref/forms/validation.txt
index c19ae34c29..5f6db434f8 100644
--- a/docs/ref/forms/validation.txt
+++ b/docs/ref/forms/validation.txt
@@ -363,8 +363,10 @@ example::
if cc_myself and subject:
# Only do something if both fields are valid so far.
if "help" not in subject:
- raise forms.ValidationError("Did not send for 'help' in "
- "the subject despite CC'ing yourself.")
+ raise forms.ValidationError(
+ "Did not send for 'help' in the subject despite "
+ "CC'ing yourself."
+ )
In this code, if the validation error is raised, the form will display an
error message at the top of the form (normally) describing the problem.
diff --git a/docs/ref/forms/widgets.txt b/docs/ref/forms/widgets.txt
index 666780bc5d..0e80aea79a 100644
--- a/docs/ref/forms/widgets.txt
+++ b/docs/ref/forms/widgets.txt
@@ -55,9 +55,11 @@ widget on the field. In the following example, the
from django import forms
BIRTH_YEAR_CHOICES = ('1980', '1981', '1982')
- FAVORITE_COLORS_CHOICES = (('blue', 'Blue'),
- ('green', 'Green'),
- ('black', 'Black'))
+ FAVORITE_COLORS_CHOICES = (
+ ('blue', 'Blue'),
+ ('green', 'Green'),
+ ('black', 'Black'),
+ )
class SimpleForm(forms.Form):
birth_year = forms.DateField(widget=forms.SelectDateWidget(years=BIRTH_YEAR_CHOICES))
@@ -364,8 +366,11 @@ foundation for custom widgets.
widget.value_from_datadict(data, files, name + '_%s' % i)
for i, widget in enumerate(self.widgets)]
try:
- D = date(day=int(datelist[0]), month=int(datelist[1]),
- year=int(datelist[2]))
+ D = date(
+ day=int(datelist[0]),
+ month=int(datelist[1]),
+ year=int(datelist[2]),
+ )
except ValueError:
return ''
else: