Code

Opened 4 years ago

Closed 4 years ago

#13728 closed (invalid)

Incorrect default value for verify_exists in URLField documentation

Reported by: marktran Owned by: suzaku
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 suzaku 4 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 4 years ago by suzaku

  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to suzaku
  • Patch needs improvement unset
  • Status changed from new to assigned

Changed 4 years ago by suzaku

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

comment:2 Changed 4 years ago by russellm

  • Has patch set
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to 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 Changed 4 years ago by timo

  • Resolution set to invalid
  • Status changed from assigned to 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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.