From 987880e13138a93d9cc0e44b7ed30297909f7b03 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Tue, 27 Jan 2015 23:15:26 +0100 Subject: Update documentation --- api-guide/fields/index.html | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) (limited to 'api-guide/fields') diff --git a/api-guide/fields/index.html b/api-guide/fields/index.html index 9cac530a..83affe26 100644 --- a/api-guide/fields/index.html +++ b/api-guide/fields/index.html @@ -405,6 +405,10 @@ URLField +
A RegexField that validates the input against a URL matching pattern. Expects fully qualified URLs of the form http://<host>/<path>.
Corresponds to django.db.models.fields.URLField. Uses Django's django.core.validators.URLValidator for validation.
Signature: URLField(max_length=200, min_length=None, allow_blank=False)
A field that ensures the input is a valid UUID string. The to_internal_value method will return a uuid.UUID instance. On output the field will return a string in the canonical hyphenated format, for example:
"de305d54-75b4-431b-adb2-eb6b9e546013"
+
Both the allow_blank and allow_null are valid options on ChoiceField, although it is highly recommended that you only use one and not both. allow_blank should be preferred for textual choices, and allow_null should be preferred for numeric or other non-textual choices.
A field that can accept a set of zero, one or many values, chosen from a limited set of choices. Takes a single mandatory argument. to_internal_representation returns a set containing the selected values.
A field that can accept a set of zero, one or many values, chosen from a limited set of choices. Takes a single mandatory argument. to_internal_value returns a set containing the selected values.
Signature: MultipleChoiceField(choices)
choices - A list of valid values, or a list of (key, display_name) tuples.We can now reuse our custom StringListField class throughout our application, without having to provide a child argument to it.
A field class that validates a dictionary of objects. The keys in DictField are always assumed to be string values.
Signature: DictField(child)
child - A field instance that should be used for validating the values in the dictionary. If this argument is not provided then values in the mapping will not be validated.For example, to create a field that validates a mapping of strings to strings, you would write something like this:
+document = DictField(child=CharField())
+
+You can also use the declarative style, as with ListField. For example:
class DocumentField(DictField):
+ child = CharField()
+