Opened 15 years ago

Closed 15 years ago

#12676 closed (worksforme)

fix documetation after merge of model-validation to trunk

Reported by: Alex Koval Owned by: nobody
Component: Uncategorized Version: 1.2-alpha
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In documentation here:

http://docs.djangoproject.com/en/dev/ref/forms/fields/#charfield

its said that valid error message keys are: required, max_length, min_length

While in fact, in trunk code those variables are:

  • limit_value
  • show_value

(see http://code.djangoproject.com/browser/django/trunk/django/core/validators.py#L108)

Documentation and code mismatch.

Change History (1)

comment:1 by Karen Tracey, 15 years ago

Resolution: worksforme
Status: newclosed

Near as I can tell the doc is still correct:

kmt@lbox:~/software/web/playground$ python manage.py shell
iPython 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> import django
>>> django.get_version()
u'1.2 alpha 1 SVN-12288'
>>> from django import forms
>>> class CForm(forms.Form):
...     s = forms.CharField(required=True,min_length=2,max_length=4,error_messages={'required': 'Gimme something', 'min
_length': 'Too Short!', 'max_length': 'Too Long'})
...
>>> cf = CForm({})
>>> cf.errors
{'s': [u'Gimme something']}
>>> cf = CForm({'s': '1'})
>>> cf.errors
{'s': [u'Too Short!']}
>>> cf = CForm({'s': '12345'})
>>> cf.errors
{'s': [u'Too Long']}
>>>
Note: See TracTickets for help on using tickets.
Back to Top