Opened 15 years ago
Closed 15 years ago
#13728 closed (invalid)
Incorrect default value for verify_exists in URLField documentation
| Reported by: | Mark Tran | Owned by: | Satoru Logic |
|---|---|---|---|
| Component: | Documentation | Version: | 1.2 |
| Severity: | Keywords: | ||
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | yes |
| Easy pickings: | no | UI/UX: | no |
Description
The Django documentation states that the default value for the keyword argument "verify_exists" is True:
http://docs.djangoproject.com/en/dev/ref/models/fields/#urlfield
http://code.djangoproject.com/browser/django/trunk/docs/ref/models/fields.txt#L799
I've noticed that the default value is actually False:
http://code.djangoproject.com/browser/django/trunk/django/forms/fields.py#L532
In [1]: from django import forms In [2]: url = forms.URLField() In [3]: url.validators[0].verify_exists Out[3]: False
Attachments (1)
Change History (4)
comment:1 by , 15 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
by , 15 years ago
| Attachment: | 13728_correct_default_value.diff added |
|---|
comment:2 by , 15 years ago
| Has patch: | set |
|---|---|
| Patch needs improvement: | set |
| Triage Stage: | Unreviewed → Accepted |
When the implemenation has existed as-is for as long as it has, we fix the documentation, not the code. Changing the code would be backwards incompatible for anyone using (and relying on) the existing implementation.
comment:3 by , 15 years ago
| Resolution: | → invalid |
|---|---|
| Status: | assigned → closed |
Actually this is documented correctly. The default for form fields is False, but the default for model fields is True.
>>> from django.db import models >>> models.URLField().validators [<django.core.validators.MaxLengthValidator object at 0x27d34d0>, <django.core.validators.URLValidator object at 0x27d3510>] <django.core.validators.URLValidator object at 0x27d3490> >>> models.URLField().validators[1].verify_exists True
Default values are set according to the document and some changes are made to other code to pass pylint check