Opened 10 years ago

Closed 10 years ago

#2266 closed enhancement (fixed)

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

Reported by: matt.riggott@… Owned by: Adrian Holovaty
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@… 10 years ago.
Patch to add RequiredIfOtherFieldsNotGiven to django.core.validators
given_validators.diff (3.3 KB) - added by alang@… 10 years ago.
Updated patches
validators.py (3.1 KB) - added by alang@… 10 years ago.
tests/othertests/validators.py

Download all attachments as: .zip

Change History (9)

Changed 10 years ago by matt.riggott@…

Patch to add RequiredIfOtherFieldsNotGiven to django.core.validators

comment:1 Changed 10 years ago by anonymous

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

Changed 10 years ago by alang@…

Attachment: given_validators.diff added

Updated patches

comment:2 Changed 10 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 10 years ago by alang@…

Attachment: validators.py added

tests/othertests/validators.py

comment:3 Changed 10 years ago by Rudolph Froger

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

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

Triage Stage: UnreviewedReady for checkin

see also #3250

comment:5 Changed 10 years ago by Malcolm Tredinnick

(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 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

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.

Note: See TracTickets for help on using tickets.
Back to Top