db.models.functions.datetime.TruncMonth

class TruncMonth(expression, output_field=None, tzinfo=None, **extra) [source] kind = 'month' These are logically equivalent to Trunc('date_field', kind). They truncate all parts of the date up to kind which allows grouping or filtering dates with less precision. expression can have an output_field of either DateField or DateTimeField. Since DateFields don’t have a time component, only Trunc subclasses that deal with date-parts can be used with DateField: >>> from datetime impo

auth.backends.RemoteUserBackend.clean_username()

RemoteUserBackend.clean_username(username) Performs any cleaning on the username (e.g. stripping LDAP DN information) prior to using it to get or create a User object. Returns the cleaned username.

auth.models.PermissionsMixin.has_module_perms()

has_module_perms(package_name) Returns True if the user has any permissions in the given package (the Django app label). If the user is inactive, this method will always return False.

views.debug.SafeExceptionReporterFilter.is_active()

SafeExceptionReporterFilter.is_active(request) [source] Returns True to activate the filtering operated in the other methods. By default the filter is active if DEBUG is False.

Writing your first Django app, part 7

This tutorial begins where Tutorial 6 left off. We’re continuing the Web-poll application and will focus on customizing Django’s automatically-generated admin site that we first explored in Tutorial 2. Customize the admin form By registering the Question model with admin.site.register(Question), Django was able to construct a default form representation. Often, you’ll want to customize how the admin form looks and works. You’ll do this by telling Django the options you want when you register th

gis.db.models.GeoQuerySet.intersection()

GeoQuerySet.intersection(geom) Deprecated since version 1.9: Use the Intersection function instead. Returns the spatial intersection of the geographic field with the given geometry in an intersection attribute on each element of the GeoQuerySet.

core.files.uploadedfile.UploadedFile.charset

UploadedFile.charset For text/* content-types, the character set (i.e. utf8) supplied by the browser. Again, “trust but verify” is the best policy here. Note Like regular Python files, you can read the file line-by-line simply by iterating over the uploaded file: for line in uploadedfile: do_something_with(line) Lines are split using universal newlines. The following are recognized as ending a line: the Unix end-of-line convention '\n', the Windows convention '\r\n', and the old Macint

db.models.options.Options

class Options [source] The model _meta API is at the core of the Django ORM. It enables other parts of the system such as lookups, queries, forms, and the admin to understand the capabilities of each model. The API is accessible through the _meta attribute of each model class, which is an instance of an django.db.models.options.Options object. Methods that it provides can be used to: Retrieve all field instances of a model Retrieve a single field instance of a model by name

forms.MultiWidget

class MultiWidget(widgets, attrs=None) [source] A widget that is composed of multiple widgets. MultiWidget works hand in hand with the MultiValueField. MultiWidget has one required argument: widgets An iterable containing the widgets needed. And one required method: decompress(value) [source] This method takes a single “compressed” value from the field and returns a list of “decompressed” values. The input value can be assumed valid, but not necessarily non-empty. This method must b

utils.encoding.smart_unicode()

smart_unicode(s, encoding='utf-8', strings_only=False, errors='strict') Historical name of smart_text(). Only available under Python 2.