Opened 9 years ago

Closed 9 years ago

Last modified 8 years ago

#1111 closed defect (fixed)

Documentation Error in custom validator example

Reported by: afarnham@… Owned by: jacob
Component: Documentation Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

From the documentation as it is at the time of this bug report:

from django.core import validators, formfields

class ContactManipulator(formfields.Manipulator):
    def __init__(self):
        self.fields = (
            # ... snip fields as above ...
            formfields.EmailField(field_name="to", validator_list=[self.isValidToAddress])
        )

    def isValidToAddress(self, field_data, all_data):
        if not field_data.endswith("@example.com"):
            raise ValidationError("You can only send messages to example.com e-mail addresses.")

Calls to ValidationError be written as such:

raise validators.ValidationError(...)

ValidationError by itself is undefined.

Change History (1)

comment:1 Changed 9 years ago by adrian

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

(In [1776]) Fixed #1111 -- Fixed bug in docs/forms.txt. Thanks, afarhham

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