Code

Opened 8 years ago

Closed 7 years ago

#2266 closed enhancement (fixed)

[patch] Form validator django.core.validators.RequiredIfOtherFieldsNotGiven does not exist

Reported by: matt.riggott@… Owned by: adrian
Component: Core (Other) Version: master
Severity: normal Keywords: form manipulator validator
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Although the validator class RequiredIfOtherFieldsNotGiven is mentioned in the Form-fields and manipulators documentation, is doesn't actually exist in django.core.validators. The attached patch adds this class.

Attachments (3)

RequiredIfOtherFieldsNotGiven.diff (1.1 KB) - added by matt.riggott@… 8 years ago.
Patch to add RequiredIfOtherFieldsNotGiven to django.core.validators
given_validators.diff (3.3 KB) - added by alang@… 8 years ago.
Updated patches
validators.py (3.1 KB) - added by alang@… 8 years ago.
tests/othertests/validators.py

Download all attachments as: .zip

Change History (9)

Changed 8 years ago by matt.riggott@…

Patch to add RequiredIfOtherFieldsNotGiven to django.core.validators

comment:1 Changed 8 years ago by anonymous

  • Summary changed from Form validator django.core.validators.RequiredIfOtherFieldsNotGiven does not exist to [patch] Form validator django.core.validators.RequiredIfOtherFieldsNotGiven does not exist

Changed 8 years ago by alang@…

Updated patches

comment:2 Changed 8 years ago by alang@…

Attached updated patches against changeset 3445 (25-July-06)

Fixed:

RequiredIfOtherFieldsNotGiven - was documented but not implemented.
RequiredIfOtherFieldsGiven - was implemented but not documented.
RequiredIfOtherFieldGiven - was implemented but not documented.

Broke the compound conditions in the validators into separate if statements, because trying to figure out what anded nots in a loop were supposed to do was making my brain hurt.

Provided some doctests for these validators. (uploaded separately)

Finally, the documented behaviour of RequiredIfOtherFieldsNotGiven was a little odd. Whereas the validator used to require a value if any of the other fields was not given, it now requires a value only when none of the other fields is given. Since the validator was not implemented previously, this is not a breaking change.

Changed 8 years ago by alang@…

tests/othertests/validators.py

comment:3 Changed 8 years ago by Rudolph

The Django docs don't mention the current RequiredIfOtherFieldGiven and RequiredIfOtherFieldsGiven validators.

comment:4 Changed 7 years ago by Simon G. <dev@…>

  • Triage Stage changed from Unreviewed to Ready for checkin

see also #3250

comment:5 Changed 7 years ago by mtredinnick

(In [5113]) Fixed up some omissions and one mysteriously documented, yet non-existent field
in the validator documentation. Patch from alang@…. Refs #2266.

comment:6 Changed 7 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

The validator framework is deprecated functionality at this point, so we aren't adding any more features to it. What I've done is removed the documentation for the non-existed RequiredIfOtherFieldsNotGiven and merged in alang's documentation for RequiredIfOtherField[s]Given.

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.