Opened 6 years ago

Closed 6 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: UI/UX:

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)

13728_correct_default_value.diff (1.9 KB) - added by Satoru Logic 6 years ago.
Default values are set according to the document and some changes are made to other code to pass pylint check

Download all attachments as: .zip

Change History (4)

comment:1 Changed 6 years ago by Satoru Logic

Needs documentation: unset
Needs tests: unset
Owner: changed from nobody to Satoru Logic
Patch needs improvement: unset
Status: newassigned

Changed 6 years ago by Satoru Logic

Default values are set according to the document and some changes are made to other code to pass pylint check

comment:2 Changed 6 years ago by Russell Keith-Magee

Has patch: set
Patch needs improvement: set
Triage Stage: UnreviewedAccepted

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 Changed 6 years ago by Tim Graham

Resolution: invalid
Status: assignedclosed

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
Note: See TracTickets for help on using tickets.
Back to Top