db.models.query.QuerySet.order_by()

order_by(*fields) By default, results returned by a QuerySet are ordered by the ordering tuple given by the ordering option in the model’s Meta. You can override this on a per-QuerySet basis by using the order_by method. Example: Entry.objects.filter(pub_date__year=2005).order_by('-pub_date', 'headline') The result above will be ordered by pub_date descending, then by headline ascending. The negative sign in front of "-pub_date" indicates descending order. Ascending order is implied. To ord

Using mixins with class-based views

Caution This is an advanced topic. A working knowledge of Django’s class-based views is advised before exploring these techniques. Django’s built-in class-based views provide a lot of functionality, but some of it you may want to use separately. For instance, you may want to write a view that renders a template to make the HTTP response, but you can’t use TemplateView; perhaps you need to render a template only on POST, with GET doing something else entirely. While you could use TemplateRespo

gis.gdal.Layer.fields

fields Returns a list of the names of each of the fields in this layer: >>> layer.fields ['Name', 'Population', 'Density', 'Created'] Returns a list of the data types of each of the fields in this layer. These are subclasses of Field, discussed below: >>> [ft.__name__ for ft in layer.field_types] ['OFTString', 'OFTReal', 'OFTReal', 'OFTDate']

core.signing.TimestampSigner.sign()

sign(value) [source] Sign value and append current timestamp to it.

test.SimpleTestCase.assertXMLEqual()

SimpleTestCase.assertXMLEqual(xml1, xml2, msg=None) [source] Asserts that the strings xml1 and xml2 are equal. The comparison is based on XML semantics. Similarly to assertHTMLEqual(), the comparison is made on parsed content, hence only semantic differences are considered, not syntax differences. When invalid XML is passed in any parameter, an AssertionError is always raised, even if both string are identical. Output in case of error can be customized with the msg argument.

gis.gdal.SpatialReference.import_epsg()

import_epsg(epsg) Import spatial reference from EPSG code.

Django at a glance

Because Django was developed in a fast-paced newsroom environment, it was designed to make common Web-development tasks fast and easy. Here’s an informal overview of how to write a database-driven Web app with Django. The goal of this document is to give you enough technical specifics to understand how Django works, but this isn’t intended to be a tutorial or reference – but we’ve got both! When you’re ready to start a project, you can start with the tutorial or dive right into more detailed do

test.Client.post()

post(path, data=None, content_type=MULTIPART_CONTENT, follow=False, secure=False, **extra) [source] Makes a POST request on the provided path and returns a Response object, which is documented below. The key-value pairs in the data dictionary are used to submit POST data. For example: >>> c = Client() >>> c.post('/login/', {'name': 'fred', 'passwd': 'secret'}) ...will result in the evaluation of a POST request to this URL: /login/ ...with this POST data: name=fred&pas

sessions.backends.base.SessionBase

class backends.base.SessionBase This is the base class for all session objects. It has the following standard dictionary methods: __getitem__(key) Example: fav_color = request.session['fav_color'] __setitem__(key, value) Example: request.session['fav_color'] = 'blue' __delitem__(key) Example: del request.session['fav_color']. This raises KeyError if the given key isn’t already in the session. __contains__(key) Example: 'fav_color' in request.session get(key, default=

db.models.Options.label

Options.label New in Django 1.9. Representation of the object, returns app_label.object_name, e.g. 'polls.Question'.