cardinal_pythonlib.django.forms


Original code copyright (C) 2009-2022 Rudolf Cardinal (rudolf@pobox.com).

This file is part of cardinal_pythonlib.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Additional Django form types and associated cleaners/validators.

class cardinal_pythonlib.django.forms.MultipleIntAreaField(*, required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=(), localize=False, disabled=False, label_suffix=None)[source]

Django forms.Field to capture multiple integers.

clean(value) List[int][source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

widget

alias of Textarea

class cardinal_pythonlib.django.forms.MultipleNhsNumberAreaField(*, required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=(), localize=False, disabled=False, label_suffix=None)[source]

Django forms.Field to capture multiple NHS numbers.

clean(value) List[int][source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

widget

alias of Textarea

class cardinal_pythonlib.django.forms.MultipleWordAreaField(*, required=True, widget=None, label=None, initial=None, help_text='', error_messages=None, show_hidden_initial=False, validators=(), localize=False, disabled=False, label_suffix=None)[source]

Django forms.Field to capture multiple words.

clean(value) List[str][source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

widget

alias of Textarea

class cardinal_pythonlib.django.forms.SingleNhsNumberField(*, max_value=None, min_value=None, **kwargs)[source]

Django forms.Field to capture a single NHS number.

clean(value) int[source]

Validate the given value and return its “cleaned” value as an appropriate Python object. Raise ValidationError for any errors.

cardinal_pythonlib.django.forms.clean_int(x) int[source]

Returns its parameter as an integer, or raises django.forms.ValidationError.

cardinal_pythonlib.django.forms.clean_nhs_number(x) int[source]

Returns its parameter as a valid integer NHS number, or raises django.forms.ValidationError.