forms.Form.is_bound

Form.is_bound If you need to distinguish between bound and unbound form instances at runtime, check the value of the form’s is_bound attribute: >>> f = ContactForm() >>> f.is_bound False >>> f = ContactForm({'subject': 'hello'}) >>> f.is_bound True Note that passing an empty dictionary creates a bound form with empty data: >>> f = ContactForm({}) >>> f.is_bound True If you have a bound Form instance and want to change the data somehow,

contenttypes.models.ContentTypeManager.get_for_id()

get_for_id(id) Lookup a ContentType by ID. Since this method uses the same shared cache as get_for_model(), it’s preferred to use this method over the usual ContentType.objects.get(pk=id)

db.models.Field.pre_save()

pre_save(model_instance, add) [source] Method called prior to get_db_prep_save() to prepare the value before being saved (e.g. for DateField.auto_now). model_instance is the instance this field belongs to and add is whether the instance is being saved to the database for the first time. It should return the value of the appropriate attribute from model_instance for this field. The attribute name is in self.attname (this is set up by Field). See Preprocessing values before saving for usage. F

forms.ModelChoiceField.queryset

queryset A QuerySet of model objects from which the choices for the field will be derived, and which will be used to validate the user’s selection. ModelChoiceField also takes two optional arguments:

gis.geos.GEOSGeometry.unary_union

GEOSGeometry.unary_union New in Django 1.10. Computes the union of all the elements of this geometry. The result obeys the following contract: Unioning a set of LineStrings has the effect of fully noding and dissolving the linework. Unioning a set of Polygons will always return a Polygon or MultiPolygon geometry (unlike GEOSGeometry.union(), which may return geometries of lower dimension if a topology collapse occurs).

messages.views.SuccessMessageMixin

class views.SuccessMessageMixin Adds a success message attribute to FormView based classes get_success_message(cleaned_data) cleaned_data is the cleaned data from the form which is used for string formatting Example views.py: from django.contrib.messages.views import SuccessMessageMixin from django.views.generic.edit import CreateView from myapp.models import Author class AuthorCreate(SuccessMessageMixin, CreateView): model = Author success_url = '/success/' success_messag

gis.gdal.SpatialReference.linear_units

linear_units Returns the value of the linear units.

core.management.BaseCommand.get_version()

BaseCommand.get_version() [source] Returns the Django version, which should be correct for all built-in Django commands. User-supplied commands can override this method to return their own version.

forms.ClearableFileInput

class ClearableFileInput [source] File upload input: <input type='file' ...>, with an additional checkbox input to clear the field’s value, if the field is not required and has initial data.

http.QueryDict.__contains__()

QueryDict.__contains__(key) Returns True if the given key is set. This lets you do, e.g., if "foo" in request.GET.