core.serializers.get_serializer()

django.core.serializers.get_serializer(format) You can also use a serializer object directly: XMLSerializer = serializers.get_serializer("xml") xml_serializer = XMLSerializer() xml_serializer.serialize(queryset) data = xml_serializer.getvalue() This is useful if you want to serialize data directly to a file-like object (which includes an HttpResponse): with open("file.xml", "w") as out: xml_serializer.serialize(SomeModel.objects.all(), stream=out) Note Calling get_serializer() with an

views.generic.dates.WeekMixin.get_prev_week()

get_prev_week(date) Returns a date object containing the first day of the week before the date provided. This function can also return None or raise an Http404 exception, depending on the values of allow_empty and allow_future.

sessions.backends.base.SessionBase.delete_test_cookie()

delete_test_cookie() Deletes the test cookie. Use this to clean up after yourself.

db.models.URLField

class URLField(max_length=200, **options) [source] A CharField for a URL. The default form widget for this field is a TextInput. Like all CharField subclasses, URLField takes the optional max_length argument. If you don’t specify max_length, a default of 200 is used.

template.response.SimpleTemplateResponse.rendered_content

SimpleTemplateResponse.rendered_content The current rendered value of the response content, using the current template and context data.

db.models.FilePathField.allow_folders

FilePathField.allow_folders Optional. Either True or False. Default is False. Specifies whether folders in the specified location should be included. Either this or allow_files must be True. Of course, these arguments can be used together. The one potential gotcha is that match applies to the base filename, not the full path. So, this example: FilePathField(path="/home/images", match="foo.*", recursive=True) ...will match /home/images/foo.png but not /home/images/foo/bar.png because the mat

gis.geos.LineString

class LineString(*args, **kwargs) LineString objects are instantiated using arguments that are either a sequence of coordinates or Point objects. For example, the following are equivalent: >>> ls = LineString((0, 0), (1, 1)) >>> ls = LineString(Point(0, 0), Point(1, 1)) In addition, LineString objects may also be created by passing in a single sequence of coordinate or Point objects: >>> ls = LineString( ((0, 0), (1, 1)) ) >>> ls = LineString( [Point(0, 0

Installing SpatiaLite

SpatiaLite adds spatial support to SQLite, turning it into a full-featured spatial database. First, check if you can install SpatiaLite from system packages or binaries. For example, on Debian-based distributions, try to install the spatialite-bin package. For distributions that package SpatiaLite 4.2+, install libsqlite3-mod-spatialite. For Mac OS X, follow the instructions below. For Windows, you may find binaries on the Gaia-SINS home page. In any case, you should always be able to install f

admin.InlineModelAdmin.form

InlineModelAdmin.form The value for form defaults to ModelForm. This is what is passed through to inlineformset_factory() when creating the formset for this inline. Warning When writing custom validation for InlineModelAdmin forms, be cautious of writing validation that relies on features of the parent model. If the parent model fails to validate, it may be left in an inconsistent state as described in the warning in Validation on a ModelForm.

utils.functional.keep_lazy()

keep_lazy(func, *resultclasses) [source] New in Django 1.10. Django offers many utility functions (particularly in django.utils) that take a string as their first argument and do something to that string. These functions are used by template filters as well as directly in other code. If you write your own similar functions and deal with translations, you’ll face the problem of what to do when the first argument is a lazy translation object. You don’t want to convert it to a string immediat