[Python-modules-commits] [python-django] 01/04: Imported Upstream version 1.8.4
Luke Faraone
lfaraone at moszumanska.debian.org
Sun Aug 23 21:25:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
lfaraone pushed a commit to branch debian/experimental
in repository python-django.
commit 44d7cd6d064c7a4c6bb1a35f6af33923f603305e
Author: Luke Faraone <lfaraone at debian.org>
Date: Wed Aug 19 03:53:24 2015 +0000
Imported Upstream version 1.8.4
---
Django.egg-info/PKG-INFO | 2 +-
Django.egg-info/SOURCES.txt | 7 ++
PKG-INFO | 2 +-
django/__init__.py | 2 +-
django/conf/global_settings.py | 2 +-
django/contrib/admin/checks.py | 22 ++---
django/contrib/contenttypes/fields.py | 6 +-
django/contrib/postgres/forms/hstore.py | 17 ++--
django/contrib/sessions/middleware.py | 2 +-
django/core/checks/__init__.py | 1 +
django/core/checks/compatibility/django_1_8_0.py | 31 ++++++
django/core/management/commands/makemessages.py | 2 +-
django/core/management/commands/migrate.py | 1 +
django/core/serializers/json.py | 5 +-
django/core/servers/basehttp.py | 2 +-
django/db/backends/postgresql_psycopg2/schema.py | 5 +
django/db/models/base.py | 24 +++++
django/db/models/fields/related.py | 9 +-
django/db/models/query.py | 6 +-
django/middleware/clickjacking.py | 2 +-
django/template/loader.py | 1 -
django/test/testcases.py | 6 +-
django/utils/lru_cache.py | 2 +-
django/views/debug.py | 2 +-
docs/faq/general.txt | 2 +-
docs/glossary.txt | 2 +-
docs/howto/custom-model-fields.txt | 4 +-
docs/howto/deployment/checklist.txt | 9 +-
docs/howto/deployment/wsgi/index.txt | 3 +-
docs/howto/error-reporting.txt | 12 ++-
docs/howto/outputting-csv.txt | 3 +-
docs/howto/outputting-pdf.txt | 5 +-
docs/internals/contributing/localizing.txt | 6 +-
docs/internals/release-process.txt | 5 +-
docs/internals/team.txt | 4 +-
docs/intro/contributing.txt | 2 +-
docs/intro/install.txt | 11 ++-
docs/intro/overview.txt | 2 +-
docs/intro/tutorial03.txt | 2 +-
docs/intro/tutorial05.txt | 4 +-
docs/ref/checks.txt | 66 +++++++++++++
docs/ref/clickjacking.txt | 4 +-
docs/ref/contrib/admin/actions.txt | 2 +-
docs/ref/contrib/admin/index.txt | 4 +-
docs/ref/contrib/contenttypes.txt | 11 +--
docs/ref/contrib/flatpages.txt | 2 +-
docs/ref/contrib/gis/gdal.txt | 8 +-
docs/ref/contrib/gis/geoip.txt | 2 +-
docs/ref/contrib/gis/geoquerysets.txt | 11 +--
docs/ref/contrib/gis/geos.txt | 4 +-
docs/ref/contrib/gis/layermapping.txt | 4 +-
docs/ref/contrib/gis/model-api.txt | 8 +-
docs/ref/contrib/gis/ogrinspect.txt | 4 +-
docs/ref/contrib/gis/tutorial.txt | 4 +-
docs/ref/contrib/messages.txt | 6 +-
docs/ref/contrib/postgres/fields.txt | 6 ++
docs/ref/contrib/staticfiles.txt | 5 +
docs/ref/databases.txt | 12 ++-
docs/ref/files/file.txt | 14 +--
docs/ref/files/storage.txt | 4 +-
docs/ref/forms/api.txt | 6 +-
docs/ref/forms/widgets.txt | 2 +-
docs/ref/middleware.txt | 6 +-
docs/ref/models/expressions.txt | 29 +++++-
docs/ref/models/fields.txt | 86 ++++++-----------
docs/ref/models/instances.txt | 17 +++-
docs/ref/models/lookups.txt | 2 +-
docs/ref/models/querysets.txt | 32 +++++-
docs/ref/models/relations.txt | 4 +-
docs/ref/request-response.txt | 44 +++++----
docs/ref/settings.txt | 15 +--
docs/ref/templates/api.txt | 6 +-
docs/ref/templates/builtins.txt | 82 +++++-----------
docs/ref/templates/language.txt | 2 +-
docs/ref/urlresolvers.txt | 5 +-
docs/ref/urls.txt | 2 +-
docs/ref/utils.txt | 4 +-
docs/ref/validators.txt | 6 +-
docs/releases/1.0.txt | 2 +-
docs/releases/1.3.txt | 2 +-
docs/releases/1.4.22.txt | 29 ++++++
docs/releases/1.4.txt | 8 +-
docs/releases/1.6.txt | 2 +-
docs/releases/1.7.10.txt | 25 +++++
docs/releases/1.8.4.txt | 49 ++++++++++
docs/releases/1.8.txt | 24 ++++-
docs/releases/index.txt | 3 +
docs/releases/security.txt | 2 +-
docs/spelling_wordlist | 2 -
docs/topics/auth/customizing.txt | 11 ++-
docs/topics/auth/default.txt | 107 +++++++++++----------
docs/topics/auth/index.txt | 4 +-
docs/topics/auth/passwords.txt | 6 +-
docs/topics/cache.txt | 4 +-
docs/topics/checks.txt | 100 ++++++++-----------
docs/topics/class-based-views/mixins.txt | 2 +-
docs/topics/db/aggregation.txt | 34 +++++--
docs/topics/db/examples/many_to_one.txt | 16 ++-
docs/topics/db/examples/one_to_one.txt | 20 ++--
docs/topics/db/optimization.txt | 12 +--
docs/topics/db/sql.txt | 2 +-
docs/topics/db/tablespaces.txt | 2 +-
docs/topics/email.txt | 2 +-
docs/topics/http/sessions.txt | 2 +-
docs/topics/http/shortcuts.txt | 6 +-
docs/topics/i18n/index.txt | 2 +-
docs/topics/i18n/timezones.txt | 2 +-
docs/topics/i18n/translation.txt | 4 +-
docs/topics/migrations.txt | 2 +-
docs/topics/security.txt | 5 +-
docs/topics/settings.txt | 24 ++++-
docs/topics/signals.txt | 6 +-
docs/topics/templates.txt | 6 +-
docs/topics/testing/advanced.txt | 4 +-
docs/topics/testing/tools.txt | 4 +-
tests/admin_checks/tests.py | 24 ++++-
tests/admin_utils/tests.py | 7 +-
tests/annotations/tests.py | 23 ++---
tests/check_framework/tests_1_8_compatibility.py | 29 ++++++
tests/contenttypes_tests/tests.py | 48 ---------
tests/forms_tests/tests/test_fields.py | 24 +++--
tests/generic_relations/tests.py | 10 ++
tests/gis_tests/test_geoip.py | 20 ++--
tests/httpwrappers/tests.py | 6 ++
tests/many_to_one/tests.py | 41 ++------
tests/migrations/test_commands.py | 46 +++++++++
tests/model_fields/test_uuid.py | 15 ++-
tests/one_to_one/tests.py | 49 +++-------
.../array_index_migrations/0001_initial.py | 26 +++++
.../array_index_migrations/__init__.py | 0
tests/postgres_tests/test_array.py | 27 ++++++
tests/postgres_tests/test_hstore.py | 19 +++-
tests/raw_query/models.py | 4 +
tests/raw_query/tests.py | 14 ++-
tests/runtests.py | 4 -
tests/servers/test_basehttp.py | 10 ++
tests/sessions_tests/tests.py | 17 ++++
tests/template_tests/filter_tests/test_urlize.py | 24 ++---
tests/test_utils/tests.py | 33 +++++++
139 files changed, 1142 insertions(+), 683 deletions(-)
diff --git a/Django.egg-info/PKG-INFO b/Django.egg-info/PKG-INFO
index d2924c6..639f603 100644
--- a/Django.egg-info/PKG-INFO
+++ b/Django.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Django
-Version: 1.8.3
+Version: 1.8.4
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: http://www.djangoproject.com/
Author: Django Software Foundation
diff --git a/Django.egg-info/SOURCES.txt b/Django.egg-info/SOURCES.txt
index 28bf82a..c3367bd 100644
--- a/Django.egg-info/SOURCES.txt
+++ b/Django.egg-info/SOURCES.txt
@@ -2756,6 +2756,7 @@ django/core/checks/model_checks.py
django/core/checks/registry.py
django/core/checks/compatibility/__init__.py
django/core/checks/compatibility/django_1_7_0.py
+django/core/checks/compatibility/django_1_8_0.py
django/core/checks/security/__init__.py
django/core/checks/security/base.py
django/core/checks/security/csrf.py
@@ -3352,6 +3353,7 @@ docs/releases/1.4.19.txt
docs/releases/1.4.2.txt
docs/releases/1.4.20.txt
docs/releases/1.4.21.txt
+docs/releases/1.4.22.txt
docs/releases/1.4.3.txt
docs/releases/1.4.4.txt
docs/releases/1.4.5.txt
@@ -3386,6 +3388,7 @@ docs/releases/1.6.8.txt
docs/releases/1.6.9.txt
docs/releases/1.6.txt
docs/releases/1.7.1.txt
+docs/releases/1.7.10.txt
docs/releases/1.7.2.txt
docs/releases/1.7.3.txt
docs/releases/1.7.4.txt
@@ -3398,6 +3401,7 @@ docs/releases/1.7.txt
docs/releases/1.8.1.txt
docs/releases/1.8.2.txt
docs/releases/1.8.3.txt
+docs/releases/1.8.4.txt
docs/releases/1.8.txt
docs/releases/index.txt
docs/releases/security.txt
@@ -3708,6 +3712,7 @@ tests/check_framework/models.py
tests/check_framework/test_model_field_deprecation.py
tests/check_framework/test_security.py
tests/check_framework/tests.py
+tests/check_framework/tests_1_8_compatibility.py
tests/choices/__init__.py
tests/choices/models.py
tests/choices/tests.py
@@ -4547,6 +4552,8 @@ tests/postgres_tests/test_unaccent.py
tests/postgres_tests/array_default_migrations/0001_initial.py
tests/postgres_tests/array_default_migrations/0002_integerarraymodel_field_2.py
tests/postgres_tests/array_default_migrations/__init__.py
+tests/postgres_tests/array_index_migrations/0001_initial.py
+tests/postgres_tests/array_index_migrations/__init__.py
tests/postgres_tests/migrations/0001_setup_extensions.py
tests/postgres_tests/migrations/0002_create_test_models.py
tests/postgres_tests/migrations/__init__.py
diff --git a/PKG-INFO b/PKG-INFO
index d2924c6..639f603 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: Django
-Version: 1.8.3
+Version: 1.8.4
Summary: A high-level Python Web framework that encourages rapid development and clean, pragmatic design.
Home-page: http://www.djangoproject.com/
Author: Django Software Foundation
diff --git a/django/__init__.py b/django/__init__.py
index 5a3eaed..6151137 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -1,6 +1,6 @@
from django.utils.version import get_version
-VERSION = (1, 8, 3, 'final', 0)
+VERSION = (1, 8, 4, 'final', 0)
__version__ = get_version(VERSION)
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
index d6263b2..e5afe0e 100644
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -34,7 +34,7 @@ INTERNAL_IPS = ()
ALLOWED_HOSTS = []
# Local time zone for this installation. All choices can be found here:
-# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all
+# https://en.wikipedia.org/wiki/List_of_tz_zones_by_name (although not all
# systems may support all possibilities). When USE_TZ is True, this is
# interpreted as the default user time zone.
TIME_ZONE = 'America/Chicago'
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py
index d8f7fe5..0d770b0 100644
--- a/django/contrib/admin/checks.py
+++ b/django/contrib/admin/checks.py
@@ -135,7 +135,7 @@ class BaseModelAdminChecks(object):
)
]
elif not isinstance(fieldset[1]['fields'], (list, tuple)):
- return must_be('a list or tuple', option="fieldsets[1]['fields']", obj=cls, id='admin.E008')
+ return must_be('a list or tuple', option="%s[1]['fields']" % label, obj=cls, id='admin.E008')
fields = flatten(fieldset[1]['fields'])
if len(fields) != len(set(fields)):
@@ -774,17 +774,15 @@ class ModelAdminChecks(BaseModelAdminChecks):
model=model, obj=cls, id='admin.E121')
else:
if field_name not in cls.list_display:
- return refer_to_missing_field(field=field_name, option=label,
- model=model, obj=cls, id='admin.E122')
-
- checks.Error(
- "The value of '%s' refers to '%s', which is not contained in 'list_display'." % (
- label, field_name
- ),
- hint=None,
- obj=cls,
- id='admin.E122',
- ),
+ return [
+ checks.Error(
+ "The value of '%s' refers to '%s', which is not "
+ "contained in 'list_display'." % (label, field_name),
+ hint=None,
+ obj=cls,
+ id='admin.E122',
+ )
+ ]
elif cls.list_display_links and field_name in cls.list_display_links:
return [
checks.Error(
diff --git a/django/contrib/contenttypes/fields.py b/django/contrib/contenttypes/fields.py
index be19352..3865e98 100644
--- a/django/contrib/contenttypes/fields.py
+++ b/django/contrib/contenttypes/fields.py
@@ -32,6 +32,7 @@ class GenericForeignKey(object):
one_to_one = False
related_model = None
+ # For backwards compatibility; ignored as of Django 1.8.4.
allow_unsaved_instance_assignment = False
def __init__(self, ct_field="content_type", fk_field="object_id", for_concrete_model=True):
@@ -243,11 +244,6 @@ class GenericForeignKey(object):
if value is not None:
ct = self.get_content_type(obj=value)
fk = value._get_pk_val()
- if not self.allow_unsaved_instance_assignment and fk is None:
- raise ValueError(
- 'Cannot assign "%r": "%s" instance isn\'t saved in the database.' %
- (value, value._meta.object_name)
- )
setattr(instance, self.ct_field, ct)
setattr(instance, self.fk_field, fk)
diff --git a/django/contrib/postgres/forms/hstore.py b/django/contrib/postgres/forms/hstore.py
index a138093..bf562c0 100644
--- a/django/contrib/postgres/forms/hstore.py
+++ b/django/contrib/postgres/forms/hstore.py
@@ -23,13 +23,14 @@ class HStoreField(forms.CharField):
def to_python(self, value):
if not value:
return {}
- try:
- value = json.loads(value)
- except ValueError:
- raise ValidationError(
- self.error_messages['invalid_json'],
- code='invalid_json',
- )
+ if not isinstance(value, dict):
+ try:
+ value = json.loads(value)
+ except ValueError:
+ raise ValidationError(
+ self.error_messages['invalid_json'],
+ code='invalid_json',
+ )
# Cast everything to strings for ease.
for key, val in value.items():
value[key] = six.text_type(val)
@@ -43,4 +44,4 @@ class HStoreField(forms.CharField):
# the same as an empty dict, if the data or initial value we get
# is None, replace it w/ {}.
initial_value = self.to_python(initial)
- return super(forms.HStoreField, self).has_changed(initial_value, data)
+ return super(HStoreField, self).has_changed(initial_value, data)
diff --git a/django/contrib/sessions/middleware.py b/django/contrib/sessions/middleware.py
index c21036b..a6c61ac 100644
--- a/django/contrib/sessions/middleware.py
+++ b/django/contrib/sessions/middleware.py
@@ -36,7 +36,7 @@ class SessionMiddleware(object):
else:
if accessed:
patch_vary_headers(response, ('Cookie',))
- if modified or settings.SESSION_SAVE_EVERY_REQUEST:
+ if (modified or settings.SESSION_SAVE_EVERY_REQUEST) and not empty:
if request.session.get_expire_at_browser_close():
max_age = None
expires = None
diff --git a/django/core/checks/__init__.py b/django/core/checks/__init__.py
index e446bdc..5b665d2 100644
--- a/django/core/checks/__init__.py
+++ b/django/core/checks/__init__.py
@@ -8,6 +8,7 @@ from .registry import register, run_checks, tag_exists, Tags
# Import these to force registration of checks
import django.core.checks.compatibility.django_1_7_0 # NOQA
+import django.core.checks.compatibility.django_1_8_0 # NOQA
import django.core.checks.model_checks # NOQA
import django.core.checks.security.base # NOQA
import django.core.checks.security.csrf # NOQA
diff --git a/django/core/checks/compatibility/django_1_8_0.py b/django/core/checks/compatibility/django_1_8_0.py
new file mode 100644
index 0000000..c0d8d0a
--- /dev/null
+++ b/django/core/checks/compatibility/django_1_8_0.py
@@ -0,0 +1,31 @@
+from __future__ import unicode_literals
+
+from django.conf import global_settings, settings
+
+from .. import Tags, Warning, register
+
+
+ at register(Tags.compatibility)
+def check_duplicate_template_settings(app_configs, **kwargs):
+ if settings.TEMPLATES:
+ values = [
+ 'TEMPLATE_DIRS',
+ 'ALLOWED_INCLUDE_ROOTS',
+ 'TEMPLATE_CONTEXT_PROCESSORS',
+ 'TEMPLATE_DEBUG',
+ 'TEMPLATE_LOADERS',
+ 'TEMPLATE_STRING_IF_INVALID',
+ ]
+ duplicates = [
+ value for value in values
+ if getattr(settings, value) != getattr(global_settings, value)
+ ]
+ if duplicates:
+ return [Warning(
+ "The standalone TEMPLATE_* settings were deprecated in Django "
+ "1.8 and the TEMPLATES dictionary takes precedence. You must "
+ "put the values of the following settings into your default "
+ "TEMPLATES dict: %s." % ", ".join(duplicates),
+ id='1_8.W001',
+ )]
+ return []
diff --git a/django/core/management/commands/makemessages.py b/django/core/management/commands/makemessages.py
index 0e0130e..022ad5f 100644
--- a/django/core/management/commands/makemessages.py
+++ b/django/core/management/commands/makemessages.py
@@ -207,7 +207,7 @@ class Command(BaseCommand):
parser.add_argument('--all', '-a', action='store_true', dest='all',
default=False, help='Updates the message files for all existing locales.')
parser.add_argument('--extension', '-e', dest='extensions',
- help='The file extension(s) to examine (default: "html,txt", or "js" '
+ help='The file extension(s) to examine (default: "html,txt,py", or "js" '
'if the domain is "djangojs"). Separate multiple extensions with '
'commas, or use -e multiple times.',
action='append')
diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py
index b372369..d26fd3d 100644
--- a/django/core/management/commands/migrate.py
+++ b/django/core/management/commands/migrate.py
@@ -197,6 +197,7 @@ class Command(BaseCommand):
if self.verbosity >= 1:
self.stdout.write(self.style.MIGRATE_HEADING("Running migrations:"))
if not plan:
+ executor.check_replacements()
if self.verbosity >= 1:
self.stdout.write(" No migrations to apply.")
# If there's changes that aren't in migrations yet, tell them how to fix it.
diff --git a/django/core/serializers/json.py b/django/core/serializers/json.py
index f67295e..e023997 100644
--- a/django/core/serializers/json.py
+++ b/django/core/serializers/json.py
@@ -9,6 +9,7 @@ import datetime
import decimal
import json
import sys
+import uuid
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
@@ -86,7 +87,7 @@ def Deserializer(stream_or_string, **options):
class DjangoJSONEncoder(json.JSONEncoder):
"""
- JSONEncoder subclass that knows how to encode date/time and decimal types.
+ JSONEncoder subclass that knows how to encode date/time, decimal types and UUIDs.
"""
def default(self, o):
# See "Date Time String Format" in the ECMA-262 specification.
@@ -108,6 +109,8 @@ class DjangoJSONEncoder(json.JSONEncoder):
return r
elif isinstance(o, decimal.Decimal):
return str(o)
+ elif isinstance(o, uuid.UUID):
+ return str(o)
else:
return super(DjangoJSONEncoder, self).default(o)
diff --git a/django/core/servers/basehttp.py b/django/core/servers/basehttp.py
index c663fd9..2fa0f6c 100644
--- a/django/core/servers/basehttp.py
+++ b/django/core/servers/basehttp.py
@@ -107,7 +107,7 @@ class WSGIRequestHandler(simple_server.WSGIRequestHandler, object):
def log_message(self, format, *args):
- msg = "[%s]" % self.log_date_time_string()
+ msg = "[%s] " % self.log_date_time_string()
try:
msg += "%s\n" % (format % args)
except UnicodeDecodeError:
diff --git a/django/db/backends/postgresql_psycopg2/schema.py b/django/db/backends/postgresql_psycopg2/schema.py
index 85d9517..9446bfd 100644
--- a/django/db/backends/postgresql_psycopg2/schema.py
+++ b/django/db/backends/postgresql_psycopg2/schema.py
@@ -26,6 +26,11 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
# a second index that specifies their operator class, which is
# needed when performing correct LIKE queries outside the
# C locale. See #12234.
+ #
+ # The same doesn't apply to array fields such as varchar[size]
+ # and text[size], so skip them.
+ if '[' in db_type:
+ continue
if db_type.startswith('varchar'):
output.append(self._create_index_sql(
model, [field], suffix='_like', sql=self.sql_create_varchar_index))
diff --git a/django/db/models/base.py b/django/db/models/base.py
index 86ba01f..c237889 100644
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -661,6 +661,30 @@ class Model(six.with_metaclass(ModelBase)):
that the "save" must be an SQL insert or update (or equivalent for
non-SQL backends), respectively. Normally, they should not be set.
"""
+ # Ensure that a model instance without a PK hasn't been assigned to
+ # a ForeignKey or OneToOneField on this model. If the field is
+ # nullable, allowing the save() would result in silent data loss.
+ for field in self._meta.concrete_fields:
+ if field.is_relation:
+ # If the related field isn't cached, then an instance hasn't
+ # been assigned and there's no need to worry about this check.
+ try:
+ getattr(self, field.get_cache_name())
+ except AttributeError:
+ continue
+ obj = getattr(self, field.name, None)
+ # A pk may have been assigned manually to a model instance not
+ # saved to the database (or auto-generated in a case like
+ # UUIDField), but we allow the save to proceed and rely on the
+ # database to raise an IntegrityError if applicable. If
+ # constraints aren't supported by the database, there's the
+ # unavoidable risk of data corruption.
+ if obj and obj.pk is None:
+ raise ValueError(
+ "save() prohibited to prevent data loss due to "
+ "unsaved related object '%s'." % field.name
+ )
+
using = using or router.db_for_write(self.__class__, instance=self)
if force_insert and (force_update or update_fields):
raise ValueError("Cannot force both insert and updating in model saving.")
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
index c0680ee..91bc7f0 100644
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -506,7 +506,7 @@ class SingleRelatedObjectDescriptor(object):
raise ValueError('Cannot assign "%r": the current database router prevents this relation.' % value)
related_pk = tuple(getattr(instance, field.attname) for field in self.related.field.foreign_related_fields)
- if not self.related.field.allow_unsaved_instance_assignment and None in related_pk:
+ if None in related_pk:
raise ValueError(
'Cannot assign "%r": "%s" instance isn\'t saved in the database.' %
(value, instance._meta.object_name)
@@ -669,12 +669,6 @@ class ReverseSingleRelatedObjectDescriptor(object):
# Set the values of the related field.
else:
for lh_field, rh_field in self.field.related_fields:
- pk = value._get_pk_val()
- if not self.field.allow_unsaved_instance_assignment and pk is None:
- raise ValueError(
- 'Cannot assign "%r": "%s" instance isn\'t saved in the database.' %
- (value, self.field.rel.to._meta.object_name)
- )
setattr(instance, lh_field.attname, getattr(value, rh_field.attname))
# Since we already know what the related object is, seed the related
@@ -1491,6 +1485,7 @@ class ForeignObject(RelatedField):
one_to_many = False
one_to_one = False
+ # For backwards compatibility; ignored as of Django 1.8.4.
allow_unsaved_instance_assignment = False
requires_unique_target = True
related_accessor_class = ForeignRelatedObjectsDescriptor
diff --git a/django/db/models/query.py b/django/db/models/query.py
index b055205..4163ce9 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1267,11 +1267,11 @@ class RawQuerySet(object):
"""
Resolve the init field names and value positions
"""
- model_init_names = [f.attname for f in self.model._meta.fields
- if f.attname in self.columns]
+ model_init_fields = [f for f in self.model._meta.fields if f.column in self.columns]
annotation_fields = [(column, pos) for pos, column in enumerate(self.columns)
if column not in self.model_fields]
- model_init_order = [self.columns.index(fname) for fname in model_init_names]
+ model_init_order = [self.columns.index(f.column) for f in model_init_fields]
+ model_init_names = [f.attname for f in model_init_fields]
return model_init_names, model_init_order, annotation_fields
def __iter__(self):
diff --git a/django/middleware/clickjacking.py b/django/middleware/clickjacking.py
index d9ee12d..f3790fb 100644
--- a/django/middleware/clickjacking.py
+++ b/django/middleware/clickjacking.py
@@ -24,7 +24,7 @@ class XFrameOptionsMiddleware(object):
clickjacking protection techniques should be used if protection in those
browsers is required.
- http://en.wikipedia.org/wiki/Clickjacking#Server_and_client
+ https://en.wikipedia.org/wiki/Clickjacking#Server_and_client
"""
def process_response(self, request, response):
# Don't set it if it's already in the response
diff --git a/django/template/loader.py b/django/template/loader.py
index 90397d9..ef529c9 100644
--- a/django/template/loader.py
+++ b/django/template/loader.py
@@ -110,7 +110,6 @@ def render_to_string(template_name, context=None,
raise ValueError(
"render_to_string doesn't support the request argument "
"when some deprecated arguments are passed.")
- continue
# Hack -- use the internal Engine instance of DjangoTemplates.
return engine.engine.render_to_string(
template_name, context, context_instance, dirs, dictionary)
diff --git a/django/test/testcases.py b/django/test/testcases.py
index ecf0eda..c960d88 100644
--- a/django/test/testcases.py
+++ b/django/test/testcases.py
@@ -958,7 +958,11 @@ class TestCase(TransactionTestCase):
except Exception:
cls._rollback_atomics(cls.cls_atomics)
raise
- cls.setUpTestData()
+ try:
+ cls.setUpTestData()
+ except Exception:
+ cls._rollback_atomics(cls.cls_atomics)
+ raise
@classmethod
def tearDownClass(cls):
diff --git a/django/utils/lru_cache.py b/django/utils/lru_cache.py
index 2ad69e6..3dae450 100644
--- a/django/utils/lru_cache.py
+++ b/django/utils/lru_cache.py
@@ -58,7 +58,7 @@ except ImportError:
f.cache_info(). Clear the cache and statistics with f.cache_clear().
Access the underlying function with f.__wrapped__.
- See: http://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
+ See: https://en.wikipedia.org/wiki/Cache_algorithms#Least_Recently_Used
"""
diff --git a/django/views/debug.py b/django/views/debug.py
index 80b0e38..f352196 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -710,7 +710,7 @@ TECHNICAL_500_TEMPLATE = ("""
function switchPastebinFriendly(link) {
s1 = "Switch to copy-and-paste view";
s2 = "Switch back to interactive view";
- link.innerHTML = link.innerHTML == s1 ? s2: s1;
+ link.innerHTML = link.innerHTML.trim() == s1 ? s2: s1;
toggle('browserTraceback', 'pastebinTraceback');
return false;
}
diff --git a/docs/faq/general.txt b/docs/faq/general.txt
index 7bbf632..73366b6 100644
--- a/docs/faq/general.txt
+++ b/docs/faq/general.txt
@@ -40,7 +40,7 @@ Django is pronounced **JANG**-oh. Rhymes with FANG-oh. The "D" is silent.
We've also recorded an `audio clip of the pronunciation`_.
-.. _Django Reinhardt: http://en.wikipedia.org/wiki/Django_Reinhardt
+.. _Django Reinhardt: https://en.wikipedia.org/wiki/Django_Reinhardt
.. _audio clip of the pronunciation: http://red-bean.com/~adrian/django_pronunciation.mp3
Is Django stable?
diff --git a/docs/glossary.txt b/docs/glossary.txt
index 3a4ad6f..c7a16e6 100644
--- a/docs/glossary.txt
+++ b/docs/glossary.txt
@@ -37,7 +37,7 @@ Glossary
`Model-view-controller`__; a software pattern. Django :ref:`follows MVC
to some extent <faq-mtv>`.
- __ http://en.wikipedia.org/wiki/Model-view-controller
+ __ https://en.wikipedia.org/wiki/Model-view-controller
project
A Python package -- i.e. a directory of code -- that contains all the
diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-fields.txt
index d1c929b..f41e950 100644
--- a/docs/howto/custom-model-fields.txt
+++ b/docs/howto/custom-model-fields.txt
@@ -48,7 +48,7 @@ something like this::
# ... (other possibly useful methods omitted) ...
-.. _Bridge: http://en.wikipedia.org/wiki/Contract_bridge
+.. _Bridge: https://en.wikipedia.org/wiki/Contract_bridge
This is just an ordinary Python class, with nothing Django-specific about it.
We'd like to be able to do things like this in our models (we assume the
@@ -243,7 +243,7 @@ arguments to pass to ``__init__()`` to re-create it.
If you haven't added any extra options on top of the field you inherited from,
then there's no need to write a new ``deconstruct()`` method. If, however,
-you're, changing the arguments passed in ``__init__()`` (like we are in
+you're changing the arguments passed in ``__init__()`` (like we are in
``HandField``), you'll need to supplement the values being passed.
The contract of ``deconstruct()`` is simple; it returns a tuple of four items:
diff --git a/docs/howto/deployment/checklist.txt b/docs/howto/deployment/checklist.txt
index 05ea3d4..60047e9 100644
--- a/docs/howto/deployment/checklist.txt
+++ b/docs/howto/deployment/checklist.txt
@@ -131,9 +131,10 @@ If you haven't set up backups for your database, do it right now!
If your site sends emails, these values need to be set correctly.
-By default, Django will send email from root at localhost. However, some mail
-providers reject all email from this address. To use a different sender
-address, modify the :setting:`SERVER_EMAIL` setting.
+By default, Django sends email from webmaster at localhost and root at localhost.
+However, some mail providers reject email from these addresses. To use
+different sender addresses, modify the :setting:`DEFAULT_FROM_EMAIL` and
+:setting:`SERVER_EMAIL` settings.
:setting:`STATIC_ROOT` and :setting:`STATIC_URL`
------------------------------------------------
@@ -228,7 +229,7 @@ See :doc:`/topics/logging` for details on logging.
See :doc:`/howto/error-reporting` for details on error reporting by email.
-.. admonition: Error reporting by email doesn't scale very well
+.. admonition:: Error reporting by email doesn't scale very well
Consider using an error monitoring system such as Sentry_ before your
inbox is flooded by reports. Sentry can also aggregate logs.
diff --git a/docs/howto/deployment/wsgi/index.txt b/docs/howto/deployment/wsgi/index.txt
index 128e296..a6c7d4b 100644
--- a/docs/howto/deployment/wsgi/index.txt
+++ b/docs/howto/deployment/wsgi/index.txt
@@ -85,7 +85,6 @@ to combine a Django application with a WSGI application of another framework.
.. note::
Some third-party WSGI middleware do not call ``close`` on the response
- object after handling a request — most notably Sentry's error reporting
- middleware up to version 2.0.7. In those cases the
+ object after handling a request. In those cases the
:data:`~django.core.signals.request_finished` signal isn't sent. This can
result in idle connections to database and memcache servers.
diff --git a/docs/howto/error-reporting.txt b/docs/howto/error-reporting.txt
index 521acf5..f1e11e6 100644
--- a/docs/howto/error-reporting.txt
+++ b/docs/howto/error-reporting.txt
@@ -114,6 +114,14 @@ and override its methods.
Filtering error reports
-----------------------
+.. warning::
+
+ Filtering sensitive data is a hard problem, and it's nearly impossible to
+ guarantee that sensitive won't leak into an error report. Therefore, error
+ reports should only be available to trusted team members and you should
+ avoid transmitting error reports unencrypted over the Internet (such as
+ through email).
+
Filtering sensitive information
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -132,8 +140,8 @@ control which information should be filtered out of error reports in a
production environment (that is, where :setting:`DEBUG` is set to ``False``):
:func:`sensitive_variables` and :func:`sensitive_post_parameters`.
-.. _`full traceback`: http://en.wikipedia.org/wiki/Stack_trace
-.. _`traceback frame`: http://en.wikipedia.org/wiki/Stack_frame
+.. _`full traceback`: https://en.wikipedia.org/wiki/Stack_trace
+.. _`traceback frame`: https://en.wikipedia.org/wiki/Stack_frame
.. function:: sensitive_variables(*variables)
diff --git a/docs/howto/outputting-csv.txt b/docs/howto/outputting-csv.txt
index 6114538..f341482 100644
--- a/docs/howto/outputting-csv.txt
+++ b/docs/howto/outputting-csv.txt
@@ -39,8 +39,7 @@ mention:
* The response gets an additional ``Content-Disposition`` header, which
contains the name of the CSV file. This filename is arbitrary; call it
- whatever you want. It'll be used by browsers in the "Save as..."
- dialogue, etc.
+ whatever you want. It'll be used by browsers in the "Save as..." dialog, etc.
* Hooking into the CSV-generation API is easy: Just pass ``response`` as the
first argument to ``csv.writer``. The ``csv.writer`` function expects a
diff --git a/docs/howto/outputting-pdf.txt b/docs/howto/outputting-pdf.txt
index 31ed83f..5b070c6 100644
--- a/docs/howto/outputting-pdf.txt
+++ b/docs/howto/outputting-pdf.txt
@@ -77,8 +77,7 @@ mention:
* The response gets an additional ``Content-Disposition`` header, which
contains the name of the PDF file. This filename is arbitrary: Call it
- whatever you want. It'll be used by browsers in the "Save as..."
- dialogue, etc.
+ whatever you want. It'll be used by browsers in the "Save as..." dialog, etc.
* The ``Content-Disposition`` header starts with ``'attachment; '`` in this
example. This forces Web browsers to pop-up a dialog box
@@ -155,7 +154,7 @@ Further resources
.. _PDFlib: http://www.pdflib.org/
.. _`Pisa XHTML2PDF`: http://www.xhtml2pdf.com/
-.. _HTMLdoc: http://www.htmldoc.org/
+.. _HTMLdoc: https://www.msweet.org/projects.php?Z1
Other formats
=============
diff --git a/docs/internals/contributing/localizing.txt b/docs/internals/contributing/localizing.txt
index bb06da1..d3b1c3a 100644
--- a/docs/internals/contributing/localizing.txt
+++ b/docs/internals/contributing/localizing.txt
@@ -62,8 +62,8 @@ Django source tree, as for any code change:
``Translations``, and attach the patch to it.
.. _Transifex: https://www.transifex.com/
-.. _Django project page: https://www.transifex.com/projects/p/django/
-.. _Transifex User Guide: http://support.transifex.com/
+.. _Django project page: https://www.transifex.com/django/django/
+.. _Transifex User Guide: http://docs.transifex.com/
.. _translating-documentation:
@@ -72,6 +72,6 @@ Documentation
There is also an opportunity to translate the documentation, though this is a
huge undertaking to complete entirely (you have been warned!). We use the same
-`Transifex tool <https://www.transifex.com/projects/p/django-docs/>`_. The
+`Transifex tool <https://www.transifex.com/django/django-docs/>`_. The
translations will appear at ``https://docs.djangoproject.com/<language_code>/``
when at least the ``docs/intro/*`` files are fully translated in your language.
diff --git a/docs/internals/release-process.txt b/docs/internals/release-process.txt
index bce7319..37a691f 100644
--- a/docs/internals/release-process.txt
+++ b/docs/internals/release-process.txt
@@ -77,8 +77,9 @@ Supported versions
==================
At any moment in time, Django's developer team will support a set of releases to
-varying levels. See `the download page`_ for the current state of support for
-each version.
+varying levels. See `the supported versions section
+<https://www.djangoproject.com/download/#supported-versions>`_ of the download
+page for the current state of support for each version.
* The current development master will get new features and bug fixes
requiring major refactoring.
diff --git a/docs/internals/team.txt b/docs/internals/team.txt
index e34faec..7368ffb 100644
--- a/docs/internals/team.txt
+++ b/docs/internals/team.txt
@@ -83,7 +83,7 @@ team <core-team>`.
as a freelance developer.
.. _luke plant: http://lukeplant.me.uk/
- .. _michael meeks: http://en.wikipedia.org/wiki/Michael_Meeks_(software)
+ .. _michael meeks: https://en.wikipedia.org/wiki/Michael_Meeks_(software)
`Russell Keith-Magee`_
Russell studied physics as an undergraduate, and studied neural networks for
@@ -603,7 +603,7 @@ Joseph Kocherhans
Joseph lives in Chicago, USA.
- .. _charango: http://en.wikipedia.org/wiki/Charango
+ .. _charango: https://en.wikipedia.org/wiki/Charango
`Gary Wilson`_
Gary starting contributing patches to Django in 2006 while developing Web
diff --git a/docs/intro/contributing.txt b/docs/intro/contributing.txt
index 2baa9b0..aa73514 100644
--- a/docs/intro/contributing.txt
+++ b/docs/intro/contributing.txt
@@ -220,7 +220,7 @@ is not very helpful at preventing that bug from reoccurring down the road.
Now for our hands-on example.
-__ http://en.wikipedia.org/wiki/Test-driven_development
+__ https://en.wikipedia.org/wiki/Test-driven_development
Writing some tests for ticket #17549
------------------------------------
diff --git a/docs/intro/install.txt b/docs/intro/install.txt
index f705697..aea5e72 100644
--- a/docs/intro/install.txt
+++ b/docs/intro/install.txt
@@ -57,12 +57,15 @@ You've got three easy options to install Django:
who have operating systems that distribute Django.
* :ref:`Install an official release <installing-official-release>`. This
- is the best approach for users who want a stable version number and aren't
- concerned about running a slightly older version of Django.
+ is the best approach for most users.
* :ref:`Install the latest development version
- <installing-development-version>`. This is best for users who want the
- latest-and-greatest features and aren't afraid of running brand-new code.
+ <installing-development-version>`. This option is for enthusiasts who want
+ the latest-and-greatest features and aren't afraid of running brand new code.
+ You might encounter new bugs in the development version, but reporting them
+ helps the development of Django. Also, releases of third-party packages are
+ less likely to be compatible with the development version than with the
+ latest stable release.
.. admonition:: Always refer to the documentation that corresponds to the
version of Django you're using!
diff --git a/docs/intro/overview.txt b/docs/intro/overview.txt
index e9f574a..09b2515 100644
--- a/docs/intro/overview.txt
+++ b/docs/intro/overview.txt
@@ -19,7 +19,7 @@ Although you can use Django without a database, it comes with an
`object-relational mapper`_ in which you describe your database layout in Python
code.
-.. _object-relational mapper: http://en.wikipedia.org/wiki/Object-relational_mapping
+.. _object-relational mapper: https://en.wikipedia.org/wiki/Object-relational_mapping
The :doc:`data-model syntax </topics/db/models>` offers many rich ways of
representing your models -- so far, it's been solving many years' worth of
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt
index cf0d4de..3705c0e 100644
--- a/docs/intro/tutorial03.txt
+++ b/docs/intro/tutorial03.txt
@@ -157,7 +157,7 @@ Finally, a performance note: these regular expressions are compiled the first
time the URLconf module is loaded. They're super fast (as long as the lookups
aren't too complex as noted above).
-.. _Wikipedia's entry: http://en.wikipedia.org/wiki/Regular_expression
+.. _Wikipedia's entry: https://en.wikipedia.org/wiki/Regular_expression
:func:`~django.conf.urls.url` argument: view
--------------------------------------------
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt
index db5187b..eaa6133 100644
--- a/docs/intro/tutorial05.txt
+++ b/docs/intro/tutorial05.txt
@@ -121,7 +121,7 @@ the next time you make a change, either when you add a new feature or fix a bug.
So let's do that right away.
-.. _test-driven development: http://en.wikipedia.org/wiki/Test-driven_development
+.. _test-driven development: https://en.wikipedia.org/wiki/Test-driven_development
Writing our first test
======================
@@ -681,7 +681,7 @@ Coverage will help to identify dead code. See
information about testing.
.. _Selenium: http://seleniumhq.org/
-.. _continuous integration: http://en.wikipedia.org/wiki/Continuous_integration
+.. _continuous integration: https://en.wikipedia.org/wiki/Continuous_integration
What's next?
============
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index b519b0a..70cc5ee 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -4,6 +4,8 @@ System check framework
.. versionadded:: 1.7
+.. currentmodule:: django.core.checks
+
The system check framework is a set of static checks for validating Django
projects. It detects common problems and provides hints for how to fix them.
The framework is extensible so you can easily add your own checks.
@@ -11,6 +13,64 @@ The framework is extensible so you can easily add your own checks.
For details on how to add your own checks and integrate them with Django's
system checks, see the :doc:`System check topic guide </topics/checks>`.
+API Reference
+=============
+
+``CheckMessage``
+-----------------
+
+.. class:: CheckMessage(level, msg, hint, obj=None, id=None)
+
+The warnings and errors raised by system checks must be instances of
+``CheckMessage``. An instance encapsulates a single reportable error or
+warning. It also provides context and hints applicable to the message, and a
+unique identifier that is used for filtering purposes.
+
+Constructor arguments are:
+
+``level``
+ The severity of the message. Use one of the predefined values: ``DEBUG``,
+ ``INFO``, ``WARNING``, ``ERROR``, ``CRITICAL``. If the level is greater or
+ equal to ``ERROR``, then Django will prevent management commands from
+ executing. Messages with level lower than ``ERROR`` (i.e. warnings) are
+ reported to the console, but can be silenced.
+
+``msg``
+ A short (less than 80 characters) string describing the problem. The string
+ should *not* contain newlines.
+
+``hint``
+ A single-line string providing a hint for fixing the problem. If no hint
+ can be provided, or the hint is self-evident from the error message, the
+ hint can be omitted, or a value of ``None`` can be used.
+
+``obj``
+ Optional. An object providing context for the message (for example, the
+ model where the problem was discovered). The object should be a model,
+ field, or manager or any other object that defines ``__str__`` method (on
... 3757 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django.git
More information about the Python-modules-commits
mailing list