test.LiveServerTestCase

class LiveServerTestCase [source] LiveServerTestCase does basically the same as TransactionTestCase with one extra feature: it launches a live Django server in the background on setup, and shuts it down on teardown. This allows the use of automated test clients other than the Django dummy client such as, for example, the Selenium client, to execute a series of functional tests inside a browser and simulate a real user’s actions. By default the live server listens on localhost and picks the f

Writing your first Django app, part 3

This tutorial begins where Tutorial 2 left off. We’re continuing the Web-poll application and will focus on creating the public interface – “views.” Overview A view is a “type” of Web page in your Django application that generally serves a specific function and has a specific template. For example, in a blog application, you might have the following views: Blog homepage – displays the latest few entries. Entry “detail” page – permalink page for a single entry. Year-based archive page – displays

test.Response.wsgi_request

wsgi_request The WSGIRequest instance generated by the test handler that generated the response.

views.generic.dates.DateMixin.get_allow_future()

get_allow_future() [source] Determine whether to include “future” objects on this page, where “future” means objects in which the field specified in date_field is greater than the current date/time. Returns allow_future by default.

gis.geos.LinearRing

class LinearRing(*args, **kwargs) LinearRing objects are constructed in the exact same way as LineString objects, however the coordinates must be closed, in other words, the first coordinates must be the same as the last coordinates. For example: >>> ls = LinearRing((0, 0), (0, 1), (1, 1), (0, 0)) Notice that (0, 0) is the first and last coordinate – if they were not equal, an error would be raised.

gis.geos.WKTWriter.write()

write(geom) Returns the WKT of the given geometry. Example: >>> from django.contrib.gis.geos import Point, WKTWriter >>> pnt = Point(1, 1) >>> wkt_w = WKTWriter() >>> wkt_w.write(pnt) 'POINT (1.0000000000000000 1.0000000000000000)'

utils.log.RequireDebugTrue

class RequireDebugTrue [source] This filter is similar to RequireDebugFalse, except that records are passed only when DEBUG is True.

Working with forms

About this document This document provides an introduction to the basics of web forms and how they are handled in Django. For a more detailed look at specific areas of the forms API, see The Forms API, Form fields, and Form and field validation. Unless you’re planning to build websites and applications that do nothing but publish content, and don’t accept input from your visitors, you’re going to need to understand and use forms. Django provides a range of tools and libraries to help you buil

utils.encoding.force_text()

force_text(s, encoding='utf-8', strings_only=False, errors='strict') [source] Similar to smart_text, except that lazy instances are resolved to strings, rather than kept as lazy objects. If strings_only is True, don’t convert (some) non-string-like objects.

gis.gdal.Layer.field_precisions

field_precisions Returns a list of the numeric precisions for each of the fields in this layer. This is meaningless (and set to zero) for non-numeric fields: >>> layer.field_precisions [0, 0, 15, 0]