test.runner.DiscoverRunner.suite_result()

DiscoverRunner.suite_result(suite, result, **kwargs) Computes and returns a return code based on a test suite, and the result from that test suite.

gis.gdal.OGRGeometry.__iter__()

__iter__() Iterates over the points in a LineString, the rings in a Polygon, or the geometries in a GeometryCollection. Not applicable to other geometry types.

db.models.Lookup.lhs

lhs The left-hand side - what is being looked up. The object must follow the Query Expression API.

Many-to-many relationships

To define a many-to-many relationship, use ManyToManyField. In this example, an Article can be published in multiple Publication objects, and a Publication has multiple Article objects: from django.db import models class Publication(models.Model): title = models.CharField(max_length=30) def __str__(self): # __unicode__ on Python 2 return self.title class Meta: ordering = ('title',) class Article(models.Model): headline = models.CharField(max_leng

views.generic.list.MultipleObjectMixin.allow_empty

allow_empty A boolean specifying whether to display the page if no objects are available. If this is False and no objects are available, the view will raise a 404 instead of displaying an empty page. By default, this is True.

Authenticating against Django’s user database from Apache

Since keeping multiple authentication databases in sync is a common problem when dealing with Apache, you can configure Apache to authenticate against Django’s authentication system directly. This requires Apache version >= 2.2 and mod_wsgi >= 2.0. For example, you could: Serve static/media files directly from Apache only to authenticated users. Authenticate access to a Subversion repository against Django users with a certain permission. Allow certain users to connect to a WebDAV share c

views.generic.edit.DeletionMixin.get_success_url()

get_success_url() Returns the url to redirect to when the nominated object has been successfully deleted. Returns success_url by default.

Examples of model relationship API usage

Many-to-many relationships Many-to-one relationships One-to-one relationships

db.models.BigAutoField

class BigAutoField(**options) [source] New in Django 1.10. A 64-bit integer, much like an AutoField except that it is guaranteed to fit numbers from 1 to 9223372036854775807.

db.models.Min

class Min(expression, output_field=None, **extra) [source] Returns the minimum value of the given expression. Default alias: <field>__min Return type: same as input field, or output_field if supplied