summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-09-14 19:22:43 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-09-14 19:22:43 +0000
commit0d52d2b2f90ea12c2ca721a46052b0c17bae3b47 (patch)
tree86d1fd701ffa4e3370fa14387cc1e20862a81ed2
parentfe78237a220ad841d806dd9ee53961e7c1d3c7b2 (diff)
Fixed #5342 -- Added max_length parameter to EmailField. Thanks, donspaulding and gwilson
git-svn-id: http://code.djangoproject.com/svn/django/trunk@6205 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/fields/__init__.py3
-rw-r--r--docs/model-api.txt6
2 files changed, 6 insertions, 3 deletions
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index 34d998c219..7986a4284a 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -686,7 +686,8 @@ class DecimalField(Field):
class EmailField(CharField):
def __init__(self, *args, **kwargs):
- kwargs['max_length'] = 75
+ if 'max_length' not in kwargs:
+ kwargs['max_length'] = 75
CharField.__init__(self, *args, **kwargs)
def get_internal_type(self):
diff --git a/docs/model-api.txt b/docs/model-api.txt
index 27207aab6f..d6327bc795 100644
--- a/docs/model-api.txt
+++ b/docs/model-api.txt
@@ -221,8 +221,10 @@ The admin represents this as an ``<input type="text">`` (a single-line input).
~~~~~~~~~~~~~~
A ``CharField`` that checks that the value is a valid e-mail address.
-This doesn't accept ``max_length``; its ``max_length`` is automatically set to
-75.
+
+In Django 0.96, this doesn't accept ``max_length``; its ``max_length`` is
+automatically set to 75. In the Django development version, ``max_length`` is
+set to 75 by default, but you can specify it to override default behavior.
``FileField``
~~~~~~~~~~~~~