Geographic Sitemaps

KML is an XML language focused on geographic visualization [1]. KMLSitemap and its compressed counterpart KMZSitemap allow you to present geolocated data in a machine-readable format. Example Reference KMLSitemap KMZSitemap Footnotes [1] http://www.opengeospatial.org/standards/kml

db.models.query.QuerySet.db

db The database that will be used if this query is executed now. Note The query parameter to QuerySet exists so that specialized query subclasses such as GeoQuerySet can reconstruct internal query state. The value of the parameter is an opaque representation of that query state and is not part of a public API. To put it simply: if you need to ask, you don’t need to use it.

sites.requests.RequestSite

class requests.RequestSite A class that shares the primary interface of Site (i.e., it has domain and name attributes) but gets its data from a Django HttpRequest object rather than from a database. __init__(request) Sets the name and domain attributes to the value of get_host(). A RequestSite object has a similar interface to a normal Site object, except its __init__() method takes an HttpRequest object. It’s able to deduce the domain and name by looking at the request’s domain. It ha

core.files.base.ContentFile

class ContentFile(File) [source] The ContentFile class inherits from File, but unlike File it operates on string content (bytes also supported), rather than an actual file. For example: from __future__ import unicode_literals from django.core.files.base import ContentFile f1 = ContentFile("esta sentencia está en español") f2 = ContentFile(b"these are bytes")

sessions.base_session.AbstractBaseSession

class base_session.AbstractBaseSession New in Django 1.9. The abstract base session model. session_key Primary key. The field itself may contain up to 40 characters. The current implementation generates a 32-character string (a random sequence of digits and lowercase ASCII letters). session_data A string containing an encoded and serialized session dictionary. expire_date A datetime designating when the session expires. Expired sessions are not available to a user, however,

db.models.query.QuerySet.raw()

raw(raw_query, params=None, translations=None) Takes a raw SQL query, executes it, and returns a django.db.models.query.RawQuerySet instance. This RawQuerySet instance can be iterated over just like an normal QuerySet to provide object instances. See the Performing raw SQL queries for more information. Warning raw() always triggers a new query and doesn’t account for previous filtering. As such, it should generally be called from the Manager or from a fresh QuerySet instance.

gis.measure.Distance

class Distance(**kwargs) [source] To initialize a distance object, pass in a keyword corresponding to the desired unit attribute name set with desired value. For example, the following creates a distance object representing 5 miles: >>> dist = Distance(mi=5) __getattr__(unit_att) Returns the distance value in units corresponding to the given unit attribute. For example: >>> print(dist.km) 8.04672 classmethod unit_attname(unit_name) Returns the distance unit attr

forms.Form.errors.as_json()

Form.errors.as_json(escape_html=False) Returns the errors serialized as JSON. >>> f.errors.as_json() {"sender": [{"message": "Enter a valid email address.", "code": "invalid"}], "subject": [{"message": "This field is required.", "code": "required"}]} By default, as_json() does not escape its output. If you are using it for something like AJAX requests to a form view where the client interprets the response and inserts errors into the page, you’ll want to be sure to escape the resul

core.files.storage.Storage.generate_filename()

generate_filename(filename) [source] New in Django 1.10. Validates the filename by calling get_valid_name() and returns a filename to be passed to the save() method. The filename argument may include a path as returned by FileField.upload_to. In that case, the path won’t be passed to get_valid_name() but will be prepended back to the resulting name. The default implementation uses os.path operations. Override this method if that’s not appropriate for your storage.

The Django admin documentation generator

Django’s admindocs app pulls documentation from the docstrings of models, views, template tags, and template filters for any app in INSTALLED_APPS and makes that documentation available from the Django admin. Overview To activate the admindocs, you will need to do the following: Add django.contrib.admindocs to your INSTALLED_APPS. Add url(r'^admin/doc/', include('django.contrib.admindocs.urls')) to your urlpatterns. Make sure it’s included before the r'^admin/' entry, so that requests to /admin