template.Library.inclusion_tag()

django.template.Library.inclusion_tag() Another common type of template tag is the type that displays some data by rendering another template. For example, Django’s admin interface uses custom template tags to display the buttons along the bottom of the “add/change” form pages. Those buttons always look the same, but the link targets change depending on the object being edited – so they’re a perfect case for using a small template that is filled with details from the current object. (In the

auth.models.User.last_name

last_name Optional. 30 characters or fewer.

gis.geos.GEOSGeometry.length

GEOSGeometry.length Returns the length of this geometry (e.g., 0 for a Point, the length of a LineString, or the circumference of a Polygon).

gis.geos.GEOSGeometry.contains()

GEOSGeometry.contains(other) Returns True if other.within(this) returns True.

db.models.Field.unique_for_year

Field.unique_for_year Like unique_for_date and unique_for_month.

Outputting CSV with Django

This document explains how to output CSV (Comma Separated Values) dynamically using Django views. To do this, you can either use the Python CSV library or the Django template system. Using the Python CSV library Python comes with a CSV library, csv. The key to using it with Django is that the csv module’s CSV-creation capability acts on file-like objects, and Django’s HttpResponse objects are file-like objects. Here’s an example: import csv from django.http import HttpResponse def some_view(re

forms.TimeField.input_formats

input_formats A list of formats used to attempt to convert a string to a valid datetime.time object. If no input_formats argument is provided, the default input formats are: '%H:%M:%S', # '14:30:59' '%H:%M', # '14:30'

auth.forms.AuthenticationForm.confirm_login_allowed()

confirm_login_allowed(user) By default, AuthenticationForm rejects users whose is_active flag is set to False. You may override this behavior with a custom policy to determine which users can log in. Do this with a custom form that subclasses AuthenticationForm and overrides the confirm_login_allowed() method. This method should raise a ValidationError if the given user may not log in. For example, to allow all users to log in regardless of “active” status: from django.contrib.auth.forms imp

http.QueryDict.setdefault()

QueryDict.setdefault(key, default=None) [source] Just like the standard dictionary setdefault() method, except it uses __setitem__() internally.

core.validators.EmailValidator.message

message The error message used by ValidationError if validation fails. Defaults to "Enter a valid email address".