Porting to Python 3

Django 1.5 is the first version of Django to support Python 3. The same code runs both on Python 2 (≥ 2.6.5) and Python 3 (≥ 3.2), thanks to the six compatibility layer. This document is primarily targeted at authors of pluggable applications who want to support both Python 2 and 3. It also describes guidelines that apply to Django’s code. Philosophy This document assumes that you are familiar with the changes between Python 2 and Python 3. If you aren’t, read Python’s official porting guide fi

gis.gdal.OGRGeometry.srs

srs This property controls the spatial reference for this geometry, or None if no spatial reference system has been assigned to it. If assigned, accessing this property returns a SpatialReference object. It may be set with another SpatialReference object, or any input that SpatialReference accepts. Example: >>> city.geom.srs.name 'GCS_WGS_1984'

core.files.storage.Storage.delete()

delete(name) [source] Deletes the file referenced by name. If deletion is not supported on the target storage system this will raise NotImplementedError instead

postgres.fields.django.postgres.forms.BaseRangeField

class django.contrib.postgres.forms.BaseRangeField Base class for form range fields. base_field The form field to use. range_type The psycopg2 range type to use.

core.validators.RegexValidator.regex

regex The regular expression pattern to search for the provided value, or a pre-compiled regular expression. By default, raises a ValidationError with message and code if a match is not found. That standard behavior can be reversed by setting inverse_match to True, in which case the ValidationError is raised when a match is found. By default, matches any string (including an empty string).

admin.ModelAdmin.change_form_template

ModelAdmin.change_form_template Path to a custom template, used by change_view().

auth.forms.PasswordChangeForm

class PasswordChangeForm A form for allowing a user to change their password.

db.models.Field.one_to_one

Field.one_to_one Boolean flag that is True if the field has a one-to-one relation, such as a OneToOneField; False otherwise.

admin.AdminSite.password_change_done_template

AdminSite.password_change_done_template Path to a custom template that will be used by the admin site password change done view.

db.models.Field.choices

Field.choices An iterable (e.g., a list or tuple) consisting itself of iterables of exactly two items (e.g. [(A, B), (A, B) ...]) to use as choices for this field. If this is given, the default form widget will be a select box with these choices instead of the standard text field. The first element in each tuple is the actual value to be set on the model, and the second element is the human-readable name. For example: YEAR_IN_SCHOOL_CHOICES = ( ('FR', 'Freshman'), ('SO', 'Sophomore')