db.models.functions.datetime.Trunc

class Trunc(expression, kind, output_field=None, tzinfo=None, **extra) [source] Truncates a date up to a significant component. When you only care if something happened in a particular year, hour, or day, but not the exact second, then Trunc (and its subclasses) can be useful to filter or aggregate your data. For example, you can use Trunc to calculate the number of sales per day. Trunc takes a single expression, representing a DateField or DateTimeField, a kind representing a date part, and

Database access optimization

Django’s database layer provides various ways to help developers get the most out of their databases. This document gathers together links to the relevant documentation, and adds various tips, organized under a number of headings that outline the steps to take when attempting to optimize your database usage. Profile first As general programming practice, this goes without saying. Find out what queries you are doing and what they are costing you. You may also want to use an external project like

django.contrib.humanize

A set of Django template filters useful for adding a “human touch” to data. To activate these filters, add 'django.contrib.humanize' to your INSTALLED_APPS setting. Once you’ve done that, use {% load humanize %} in a template, and you’ll have access to the following filters. apnumber For numbers 1-9, returns the number spelled out. Otherwise, returns the number. This follows Associated Press style. Examples: 1 becomes one. 2 becomes two. 10 becomes 10. You can pass in either an integer or

core.checks.Error

class Error(msg, hint=None, obj=None, id=None) [source]

test.Client.options()

options(path, data='', content_type='application/octet-stream', follow=False, secure=False, **extra) [source] Makes an OPTIONS request on the provided path and returns a Response object. Useful for testing RESTful interfaces. When data is provided, it is used as the request body, and a Content-Type header is set to content_type. The follow, secure and extra arguments act the same as for Client.get().

core.validators.RegexValidator.message

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

core.files.storage.FileSystemStorage.location

location Absolute path to the directory that will hold the files. Defaults to the value of your MEDIA_ROOT setting.

http.HttpResponseNotModified

class HttpResponseNotModified [source] The constructor doesn’t take any arguments and no content should be added to this response. Use this to designate that a page hasn’t been modified since the user’s last request (status code 304).

db.models.Expression.asc()

asc() Returns the expression ready to be sorted in ascending order.

forms.formsets.formset_factory()

formset_factory(form, formset=BaseFormSet, extra=1, can_order=False, can_delete=False, max_num=None, validate_max=False, min_num=None, validate_min=False) [source] Returns a FormSet class for the given form class. See formsets for example usage.