Form and field validation

Form validation happens when the data is cleaned. If you want to customize this process, there are various places to make changes, each one serving a different purpose. Three types of cleaning methods are run during form processing. These are normally executed when you call the is_valid() method on a form. There are other things that can also trigger cleaning and validation (accessing the errors attribute or calling full_clean() directly), but normally they won’t be needed. In general, any clea

template.backends.base.Template.render()

Template.render(context=None, request=None) Renders this template with a given context. If context is provided, it must be a dict. If it isn’t provided, the engine will render the template with an empty context. If request is provided, it must be an HttpRequest. Then the engine must make it, as well as the CSRF token, available in the template. How this is achieved is up to each backend. Here’s an example of the search algorithm. For this example the TEMPLATES setting is: TEMPLATES = [ {

admin.ModelAdmin.get_prepopulated_fields()

ModelAdmin.get_prepopulated_fields(request, obj=None) The get_prepopulated_fields method is given the HttpRequest and the obj being edited (or None on an add form) and is expected to return a dictionary, as described above in the ModelAdmin.prepopulated_fields section.

gis.db.models.functions.Centroid

class Centroid(expression, **extra) Availability: MySQL, PostGIS, Oracle, SpatiaLite Accepts a single geographic field or expression and returns the centroid value of the geometry.

postgres.operations.CreateExtension

class CreateExtension(name) [source] An Operation subclass which installs PostgreSQL extensions. name This is a required argument. The name of the extension to be installed.

gis.geos.GEOSGeometry.empty

GEOSGeometry.empty Returns whether or not the set of points in the geometry is empty.

forms.TypedChoiceField.empty_value

empty_value The value to use to represent “empty.” Defaults to the empty string; None is another common choice here. Note that this value will not be coerced by the function given in the coerce argument, so choose it accordingly.

db.models.Func.arg_joiner

arg_joiner A class attribute that denotes the character used to join the list of expressions together. Defaults to ', '.

core.paginator.Page.number

Page.number The 1-based page number for this page.

core.management.BaseCommand.style

BaseCommand.style An instance attribute that helps create colored output when writing to stdout or stderr. For example: self.stdout.write(self.style.SUCCESS('...')) See Syntax coloring to learn how to modify the color palette and to see the available styles (use uppercased versions of the “roles” described in that section). If you pass the --no-color option when running your command, all self.style() calls will return the original string uncolored.