auth.mixins.AccessMixin.get_login_url()

get_login_url() Returns the URL that users who don’t pass the test will be redirected to. Returns login_url if set, or settings.LOGIN_URL otherwise.

auth.mixins.AccessMixin.get_permission_denied_message()

get_permission_denied_message() When raise_exception is True, this method can be used to control the error message passed to the error handler for display to the user. Returns the permission_denied_message attribute by default.

contenttypes.models.ContentTypeManager.get_for_models()

get_for_models(*models, for_concrete_models=True) Takes a variadic number of model classes, and returns a dictionary mapping the model classes to the ContentType instances representing them. for_concrete_models=False allows fetching the ContentType of proxy models.

staticfiles.testing.StaticLiveServerTestCase

class testing.StaticLiveServerTestCase This unittest TestCase subclass extends django.test.LiveServerTestCase. Just like its parent, you can use it to write tests that involve running the code under test and consuming it with testing tools through HTTP (e.g. Selenium, PhantomJS, etc.), because of which it’s needed that the static assets are also published. But given the fact that it makes use of the django.contrib.staticfiles.views.serve() view described above, it can transparently overlay a

gis.gdal.GDALRaster.width

width The width of the source in pixels (X-axis). >>> GDALRaster({'width': 10, 'height': 20, 'srid': 4326}).width 10

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).