[Python-modules-commits] [python-django] 01/07: Import python-django_1.8.12.orig.tar.gz

Raphaël Hertzog hertzog at moszumanska.debian.org
Mon Apr 4 13:38:19 UTC 2016


This is an automated email from the git hooks/post-receive script.

hertzog pushed a commit to branch debian/jessie-backports
in repository python-django.

commit 407566d2aa2d259bac26c0639018ff7d49362414
Author: Raphaël Hertzog <hertzog at debian.org>
Date:   Mon Apr 4 13:51:34 2016 +0200

    Import python-django_1.8.12.orig.tar.gz
---
 Django.egg-info/PKG-INFO                           |  2 +-
 Django.egg-info/SOURCES.txt                        |  1 +
 PKG-INFO                                           |  2 +-
 django/__init__.py                                 |  2 +-
 django/contrib/admin/options.py                    |  4 +--
 .../static/admin/js/admin/RelatedObjectLookups.js  |  9 ++++++
 .../contrib/admin/templates/admin/change_form.html |  4 ---
 .../contrib/gis/db/backends/postgis/operations.py  |  2 +-
 .../gis/db/backends/spatialite/operations.py       |  2 +-
 django/contrib/sitemaps/__init__.py                |  2 +-
 django/db/migrations/autodetector.py               |  2 +-
 django/db/models/fields/__init__.py                |  3 +-
 django/db/models/query.py                          |  4 +--
 django/db/models/sql/query.py                      |  2 +-
 django/http/multipartparser.py                     |  5 ++--
 .../contributing/writing-documentation.txt         |  6 ++--
 docs/ref/class-based-views/generic-editing.txt     |  2 +-
 docs/ref/views.txt                                 |  2 +-
 docs/releases/1.8.12.txt                           | 20 +++++++++++++
 docs/releases/index.txt                            |  1 +
 docs/topics/auth/default.txt                       |  2 +-
 docs/topics/db/aggregation.txt                     |  2 +-
 docs/topics/db/optimization.txt                    |  2 +-
 docs/topics/templates.txt                          |  2 +-
 docs/topics/testing/advanced.txt                   |  2 +-
 setup.cfg                                          |  2 +-
 tests/admin_views/admin.py                         | 29 +++++++++++-------
 tests/admin_views/models.py                        | 13 ++++++++
 tests/admin_views/tests.py                         | 29 ++++++++++++++----
 tests/aggregation/tests.py                         |  2 +-
 tests/aggregation_regress/tests.py                 |  2 +-
 tests/annotations/tests.py                         |  2 +-
 tests/cache/tests.py                               |  2 +-
 tests/delete/tests.py                              |  4 +--
 tests/expressions/tests.py                         |  2 +-
 tests/expressions_case/tests.py                    |  2 +-
 tests/file_uploads/tests.py                        | 35 ++++++++++++++++++++++
 tests/generic_relations_regress/tests.py           |  2 +-
 tests/gis_tests/test_measure.py                    |  2 +-
 tests/model_fields/test_durationfield.py           |  6 ++++
 tests/model_inheritance/tests.py                   |  6 ++--
 tests/queries/tests.py                             |  6 ++--
 tests/select_related_regress/tests.py              |  2 +-
 tests/signing/tests.py                             |  2 +-
 tests/update/tests.py                              |  2 +-
 45 files changed, 172 insertions(+), 67 deletions(-)

diff --git a/Django.egg-info/PKG-INFO b/Django.egg-info/PKG-INFO
index c536eb8..389cd94 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.11
+Version: 1.8.12
 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 5399da9..7e32870 100644
--- a/Django.egg-info/SOURCES.txt
+++ b/Django.egg-info/SOURCES.txt
@@ -3404,6 +3404,7 @@ docs/releases/1.7.txt
 docs/releases/1.8.1.txt
 docs/releases/1.8.10.txt
 docs/releases/1.8.11.txt
+docs/releases/1.8.12.txt
 docs/releases/1.8.2.txt
 docs/releases/1.8.3.txt
 docs/releases/1.8.4.txt
diff --git a/PKG-INFO b/PKG-INFO
index c536eb8..389cd94 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: Django
-Version: 1.8.11
+Version: 1.8.12
 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 99e91ca..bfcda97 100644
--- a/django/__init__.py
+++ b/django/__init__.py
@@ -1,6 +1,6 @@
 from django.utils.version import get_version
 
-VERSION = (1, 8, 11, 'final', 0)
+VERSION = (1, 8, 12, 'final', 0)
 
 __version__ = get_version(VERSION)
 
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
index 65653a6..2eba1a2 100644
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -638,9 +638,9 @@ class ModelAdmin(BaseModelAdmin):
         extra = '' if settings.DEBUG else '.min'
         js = [
             'core.js',
-            'admin/RelatedObjectLookups.js',
             'jquery%s.js' % extra,
-            'jquery.init.js'
+            'jquery.init.js',
+            'admin/RelatedObjectLookups.js',
         ]
         if self.actions is not None:
             js.append('actions%s.js' % extra)
diff --git a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
index ffba7cd..d358b20 100644
--- a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
+++ b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
@@ -128,3 +128,12 @@ function dismissDeleteRelatedObjectPopup(win, objId) {
 // Kept for backward compatibility
 showAddAnotherPopup = showRelatedObjectPopup;
 dismissAddAnotherPopup = dismissAddRelatedObjectPopup;
+
+django.jQuery(function($){
+    $(document).ready(function() {
+        $('.related-lookup').click(function(e) {
+            e.preventDefault();
+            showRelatedObjectLookupPopup(this);
+        });
+    });
+});
diff --git a/django/contrib/admin/templates/admin/change_form.html b/django/contrib/admin/templates/admin/change_form.html
index 5e6c0c6..cde7625 100644
--- a/django/contrib/admin/templates/admin/change_form.html
+++ b/django/contrib/admin/templates/admin/change_form.html
@@ -75,10 +75,6 @@
                     e.preventDefault();
                     showAddAnotherPopup(this);
                 });
-                $('.related-lookup').click(function(e) {
-                    e.preventDefault();
-                    showRelatedObjectLookupPopup(this);
-                });
             {% if adminform and add %}
                 $('form#{{ opts.model_name }}_form :input:visible:enabled:first').focus()
             {% endif %}
diff --git a/django/contrib/gis/db/backends/postgis/operations.py b/django/contrib/gis/db/backends/postgis/operations.py
index 6913533..cfb7d19 100644
--- a/django/contrib/gis/db/backends/postgis/operations.py
+++ b/django/contrib/gis/db/backends/postgis/operations.py
@@ -208,7 +208,7 @@ class PostGISOperations(BaseSpatialOperations, DatabaseOperations):
 
     def convert_geom(self, hex, geo_field):
         """
-        Converts the geometry returned from PostGIS aggretates.
+        Converts the geometry returned from PostGIS aggregates.
         """
         if hex:
             return Geometry(hex, srid=geo_field.srid)
diff --git a/django/contrib/gis/db/backends/spatialite/operations.py b/django/contrib/gis/db/backends/spatialite/operations.py
index 6c89849..18bcf96 100644
--- a/django/contrib/gis/db/backends/spatialite/operations.py
+++ b/django/contrib/gis/db/backends/spatialite/operations.py
@@ -145,7 +145,7 @@ class SpatiaLiteOperations(BaseSpatialOperations, DatabaseOperations):
 
     def geo_db_type(self, f):
         """
-        Returns None because geometry columnas are added via the
+        Returns None because geometry columns are added via the
         `AddGeometryColumn` stored procedure on SpatiaLite.
         """
         return None
diff --git a/django/contrib/sitemaps/__init__.py b/django/contrib/sitemaps/__init__.py
index 3db4ef5..05d1cbf 100644
--- a/django/contrib/sitemaps/__init__.py
+++ b/django/contrib/sitemaps/__init__.py
@@ -49,7 +49,7 @@ def ping_google(sitemap_url=None, ping_url=PING_URL):
 
 class Sitemap(object):
     # This limit is defined by Google. See the index documentation at
-    # http://sitemaps.org/protocol.php#index.
+    # http://www.sitemaps.org/protocol.html#index.
     limit = 50000
 
     # If protocol is None, the URLs in the sitemap will use the protocol
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index 33a9e9e..4f53825 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -36,7 +36,7 @@ class MigrationAutodetector(object):
 
     def changes(self, graph, trim_to_apps=None, convert_apps=None, migration_name=None):
         """
-        Main entry point to produce a list of appliable changes.
+        Main entry point to produce a list of applicable changes.
         Takes a graph to base names on and an optional set of apps
         to try and restrict to (restriction is not guaranteed)
         """
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
index e0534b8..8bba4cb 100644
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -1680,7 +1680,8 @@ class DurationField(Field):
             return value
         if value is None:
             return None
-        return value.total_seconds() * 1000000
+        # Discard any fractional microseconds due to floating point arithmetic.
+        return int(round(value.total_seconds() * 1000000))
 
     def get_db_converters(self, connection):
         converters = []
diff --git a/django/db/models/query.py b/django/db/models/query.py
index 0a73684..b6ef0c8 100644
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -16,10 +16,10 @@ from django.db import (
 from django.db.models import sql
 from django.db.models.constants import LOOKUP_SEP
 from django.db.models.deletion import Collector
-from django.db.models.expressions import F, Date, DateTime
+from django.db.models.expressions import Date, DateTime, F
 from django.db.models.fields import AutoField, Empty
 from django.db.models.query_utils import (
-    Q, InvalidQuery, deferred_class_factory,
+    InvalidQuery, Q, deferred_class_factory,
 )
 from django.db.models.sql.constants import CURSOR
 from django.utils import six, timezone
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
index 40b6cc5..d267e8d 100644
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -18,7 +18,7 @@ from django.db.models.aggregates import Count
 from django.db.models.constants import LOOKUP_SEP
 from django.db.models.expressions import Col, Ref
 from django.db.models.query_utils import (
-    Q, PathInfo, refs_aggregate, refs_expression,
+    PathInfo, Q, refs_aggregate, refs_expression,
 )
 from django.db.models.sql.constants import (
     INNER, LOUTER, ORDER_DIR, ORDER_PATTERN, QUERY_TERMS, SINGLE,
diff --git a/django/http/multipartparser.py b/django/http/multipartparser.py
index 375584e..67d0fc4 100644
--- a/django/http/multipartparser.py
+++ b/django/http/multipartparser.py
@@ -181,10 +181,11 @@ class MultiPartParser(object):
                 elif item_type == FILE:
                     # This is a file, use the handler...
                     file_name = disposition.get('filename')
+                    if file_name:
+                        file_name = force_text(file_name, encoding, errors='replace')
+                        file_name = self.IE_sanitize(unescape_entities(file_name))
                     if not file_name:
                         continue
-                    file_name = force_text(file_name, encoding, errors='replace')
-                    file_name = self.IE_sanitize(unescape_entities(file_name))
 
                     content_type, content_type_extra = meta_data.get('content-type', ('', {}))
                     content_type = content_type.strip()
diff --git a/docs/internals/contributing/writing-documentation.txt b/docs/internals/contributing/writing-documentation.txt
index 034aa59..38da974 100644
--- a/docs/internals/contributing/writing-documentation.txt
+++ b/docs/internals/contributing/writing-documentation.txt
@@ -151,10 +151,8 @@ documentation:
 Django-specific markup
 ----------------------
 
-Besides the `Sphinx built-in markup`__, Django's docs defines some extra
-description units:
-
-__ http://sphinx-doc.org/markup/
+Besides the :ref:`Sphinx built-in markup <sphinx:sphinxmarkup>`, Django's
+docs defines some extra description units:
 
 * Settings::
 
diff --git a/docs/ref/class-based-views/generic-editing.txt b/docs/ref/class-based-views/generic-editing.txt
index bb83fa5..f68cdfd 100644
--- a/docs/ref/class-based-views/generic-editing.txt
+++ b/docs/ref/class-based-views/generic-editing.txt
@@ -132,7 +132,7 @@ CreateView
 
         <form action="" method="post">{% csrf_token %}
             {{ form.as_p }}
-            <input type="submit" value="Create" />
+            <input type="submit" value="Save" />
         </form>
 
 UpdateView
diff --git a/docs/ref/views.txt b/docs/ref/views.txt
index d15e444..a9a886c 100644
--- a/docs/ref/views.txt
+++ b/docs/ref/views.txt
@@ -35,7 +35,7 @@ built-in handling for user-uploaded files, but you can have Django serve your
             url(r'^media/(?P<path>.*)$', serve, {
                 'document_root': settings.MEDIA_ROOT,
             }),
-       ]
+        ]
 
 Note, the snippet assumes your :setting:`MEDIA_URL` has a value of
 ``'/media/'``. This will call the :func:`~django.views.static.serve` view,
diff --git a/docs/releases/1.8.12.txt b/docs/releases/1.8.12.txt
new file mode 100644
index 0000000..d83e095
--- /dev/null
+++ b/docs/releases/1.8.12.txt
@@ -0,0 +1,20 @@
+===========================
+Django 1.8.12 release notes
+===========================
+
+*April 1, 2016*
+
+Django 1.8.12 fixes several bugs in 1.8.11.
+
+Bugfixes
+========
+
+* Made ``MultiPartParser`` ignore filenames that normalize to an empty string
+  to fix crash in ``MemoryFileUploadHandler`` on specially crafted user input
+  (:ticket:`26325`).
+
+* Fixed data loss on SQLite where ``DurationField`` values with fractional
+  seconds could be saved as ``None`` (:ticket:`26324`).
+
+* Restored the functionality of the admin's ``raw_id_fields`` in
+  ``list_editable`` (:ticket:`26387`).
diff --git a/docs/releases/index.txt b/docs/releases/index.txt
index dc1823b..c4e4c74 100644
--- a/docs/releases/index.txt
+++ b/docs/releases/index.txt
@@ -25,6 +25,7 @@ versions of the documentation contain the release notes for any later releases.
 .. toctree::
    :maxdepth: 1
 
+   1.8.12
    1.8.11
    1.8.10
    1.8.9
diff --git a/docs/topics/auth/default.txt b/docs/topics/auth/default.txt
index 0bdfd24..72f838e 100644
--- a/docs/topics/auth/default.txt
+++ b/docs/topics/auth/default.txt
@@ -598,8 +598,8 @@ The permission_required decorator
 
         from django.contrib.auth.decorators import login_required, permission_required
 
-        @permission_required('polls.can_vote', raise_exception=True)
         @login_required
+        @permission_required('polls.can_vote', raise_exception=True)
         def my_view(request):
             ...
 
diff --git a/docs/topics/db/aggregation.txt b/docs/topics/db/aggregation.txt
index f346481..f3618e4 100644
--- a/docs/topics/db/aggregation.txt
+++ b/docs/topics/db/aggregation.txt
@@ -295,7 +295,7 @@ file::
 
     >>> Author.objects.aggregate(average_rating=Avg('book__rating'))
 
-(The resulting dictionary will have a key called ``'average__rating'``. If no
+(The resulting dictionary will have a key called ``'average_rating'``. If no
 such alias were specified, it would be the rather long ``'book__rating__avg'``.)
 
 Aggregations and other QuerySet clauses
diff --git a/docs/topics/db/optimization.txt b/docs/topics/db/optimization.txt
index f8e0316..5ebc690 100644
--- a/docs/topics/db/optimization.txt
+++ b/docs/topics/db/optimization.txt
@@ -161,7 +161,7 @@ So using the :ref:`example Weblog models <queryset-model-example>`::
 
 will be quicker than:
 
-  >>> entry = Entry.object.get(headline="News Item Title")
+  >>> entry = Entry.objects.get(headline="News Item Title")
 
 because ``id`` is indexed by the database and is guaranteed to be unique.
 
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt
index 4716e78..cf34f71 100644
--- a/docs/topics/templates.txt
+++ b/docs/topics/templates.txt
@@ -694,4 +694,4 @@ Django provides many :ref:`built-in context processors <context-processors>`.
 Implementing a custom context processor is as simple as defining a function.
 
 .. _Jinja2: http://jinja.pocoo.org/
-.. _DEP 182: https://github.com/django/deps/blob/master/accepted/0182-multiple-template-engines.rst
+.. _DEP 182: https://github.com/django/deps/blob/master/final/0182-multiple-template-engines.rst
diff --git a/docs/topics/testing/advanced.txt b/docs/topics/testing/advanced.txt
index c3ec57a..6e54d8d 100644
--- a/docs/topics/testing/advanced.txt
+++ b/docs/topics/testing/advanced.txt
@@ -372,7 +372,7 @@ behavior. This class defines the ``run_tests()`` entry point, plus a
 selection of other methods that are used to by ``run_tests()`` to set up,
 execute and tear down the test suite.
 
-.. class:: DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=True, keepdb=False, reverse=False, debug_sql=False, **kwargs)
+.. class:: DiscoverRunner(pattern='test*.py', top_level=None, verbosity=1, interactive=True, failfast=False, keepdb=False, reverse=False, debug_sql=False, **kwargs)
 
     ``DiscoverRunner`` will search for tests in any file matching ``pattern``.
 
diff --git a/setup.cfg b/setup.cfg
index fac4f6b..7b39658 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -21,7 +21,7 @@ license-file = LICENSE
 universal = 1
 
 [egg_info]
-tag_build = 
 tag_date = 0
+tag_build = 
 tag_svn_revision = 0
 
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
index 68960df..8a980f4 100644
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -33,16 +33,17 @@ from .models import (
     GenRelReference, Grommet, ImplicitlyGeneratedPK, Ingredient,
     InlineReference, InlineReferer, Inquisition, Language, Link,
     MainPrepopulated, ModelWithStringPrimaryKey, NotReferenced, OldSubscriber,
-    OtherStory, Paper, Parent, ParentWithDependentChildren, Person, Persona,
-    Picture, Pizza, Plot, PlotDetails, PlotProxy, PluggableSearchPerson,
-    Podcast, Post, PrePopulatedPost, PrePopulatedPostLargeSlug,
-    PrePopulatedSubPost, Promo, Question, Recipe, Recommendation, Recommender,
-    ReferencedByGenRel, ReferencedByInline, ReferencedByParent,
-    RelatedPrepopulated, Report, Reservation, Restaurant,
-    RowLevelChangePermissionModel, Section, ShortMessage, Simple, Sketch,
-    State, Story, StumpJoke, Subscriber, SuperVillain, Telegram, Thing,
-    Topping, UnchangeableObject, UndeletableObject, UnorderedObject,
-    UserMessenger, Villain, Vodcast, Whatsit, Widget, Worker, WorkHour,
+    OtherStory, Paper, Parent, ParentWithDependentChildren, ParentWithUUIDPK,
+    Person, Persona, Picture, Pizza, Plot, PlotDetails, PlotProxy,
+    PluggableSearchPerson, Podcast, Post, PrePopulatedPost,
+    PrePopulatedPostLargeSlug, PrePopulatedSubPost, Promo, Question, Recipe,
+    Recommendation, Recommender, ReferencedByGenRel, ReferencedByInline,
+    ReferencedByParent, RelatedPrepopulated, RelatedWithUUIDPKModel, Report,
+    Reservation, Restaurant, RowLevelChangePermissionModel, Section,
+    ShortMessage, Simple, Sketch, State, Story, StumpJoke, Subscriber,
+    SuperVillain, Telegram, Thing, Topping, UnchangeableObject,
+    UndeletableObject, UnorderedObject, UserMessenger, Villain, Vodcast,
+    Whatsit, Widget, Worker, WorkHour,
 )
 
 
@@ -989,5 +990,13 @@ site.register(Group, GroupAdmin)
 site2 = admin.AdminSite(name="namespaced_admin")
 site2.register(User, UserAdmin)
 site2.register(Group, GroupAdmin)
+site2.register(ParentWithUUIDPK)
+site2.register(
+    RelatedWithUUIDPKModel,
+    list_display=['pk', 'parent'],
+    list_editable=['parent'],
+    raw_id_fields=['parent'],
+)
+
 site7 = admin.AdminSite(name="admin7")
 site7.register(Article, ArticleAdmin2)
diff --git a/tests/admin_views/models.py b/tests/admin_views/models.py
index 9218241..e5f6cc9 100644
--- a/tests/admin_views/models.py
+++ b/tests/admin_views/models.py
@@ -4,6 +4,7 @@ from __future__ import unicode_literals
 import datetime
 import os
 import tempfile
+import uuid
 
 from django.contrib.auth.models import User
 from django.contrib.contenttypes.fields import (
@@ -909,3 +910,15 @@ class ReferencedByGenRel(models.Model):
 
 class GenRelReference(models.Model):
     references = GenericRelation(ReferencedByGenRel)
+
+
+class ParentWithUUIDPK(models.Model):
+    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
+    title = models.CharField(max_length=100)
+
+    def __str__(self):
+        return str(self.id)
+
+
+class RelatedWithUUIDPKModel(models.Model):
+    parent = models.ForeignKey(ParentWithUUIDPK, on_delete=models.CASCADE)
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
index cb804dc..5b60368 100644
--- a/tests/admin_views/tests.py
+++ b/tests/admin_views/tests.py
@@ -51,12 +51,12 @@ from .models import (
     EmptyModel, FancyDoodad, FieldOverridePost, FilteredManager, FooAccount,
     FoodDelivery, FunkyTag, Gallery, Grommet, Inquisition, Language, Link,
     MainPrepopulated, ModelWithStringPrimaryKey, OtherStory, Paper, Parent,
-    ParentWithDependentChildren, Person, Persona, Picture, Pizza, Plot,
-    PlotDetails, PluggableSearchPerson, Podcast, Post, Promo, Question,
-    RelatedPrepopulated, Report, Restaurant, RowLevelChangePermissionModel,
-    Section, ShortMessage, Simple, Story, Subscriber, Telegram, Topping,
-    UnchangeableObject, UndeletableObject, UnorderedObject, Villain, Vodcast,
-    Whatsit, Widget, Worker, WorkHour,
+    ParentWithDependentChildren, ParentWithUUIDPK, Person, Persona, Picture,
+    Pizza, Plot, PlotDetails, PluggableSearchPerson, Podcast, Post, Promo,
+    Question, RelatedPrepopulated, RelatedWithUUIDPKModel, Report, Restaurant,
+    RowLevelChangePermissionModel, Section, ShortMessage, Simple, Story,
+    Subscriber, Telegram, Topping, UnchangeableObject, UndeletableObject,
+    UnorderedObject, Villain, Vodcast, Whatsit, Widget, Worker, WorkHour,
 )
 
 
@@ -4056,6 +4056,23 @@ class SeleniumAdminViewsFirefoxTests(AdminSeleniumWebDriverTestCase):
         self.assertEqual(Pizza.objects.count(), 1)
         self.assertEqual(Topping.objects.count(), 2)
 
+    def test_list_editable_raw_id_fields(self):
+        parent = ParentWithUUIDPK.objects.create(title='test')
+        parent2 = ParentWithUUIDPK.objects.create(title='test2')
+        RelatedWithUUIDPKModel.objects.create(parent=parent)
+        self.admin_login(username='super', password='secret', login_url=reverse('admin:index'))
+        change_url = reverse('admin:admin_views_relatedwithuuidpkmodel_changelist', current_app=site2.name)
+        self.selenium.get(self.live_server_url + change_url)
+        self.selenium.find_element_by_id('lookup_id_form-0-parent').click()
+        self.wait_for_popup()
+        self.selenium.switch_to.window(self.selenium.window_handles[-1])
+        # Select "parent2" in the popup.
+        self.selenium.find_element_by_link_text(str(parent2.pk)).click()
+        self.selenium.switch_to.window(self.selenium.window_handles[0])
+        # The newly selected pk should appear in the raw id input.
+        value = self.selenium.find_element_by_id('id_form-0-parent').get_attribute('value')
+        self.assertEqual(value, str(parent2.pk))
+
 
 class SeleniumAdminViewsChromeTests(SeleniumAdminViewsFirefoxTests):
     webdriver_class = 'selenium.webdriver.chrome.webdriver.WebDriver'
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py
index d9404cc..fc88cc5 100644
--- a/tests/aggregation/tests.py
+++ b/tests/aggregation/tests.py
@@ -7,7 +7,7 @@ from decimal import Decimal
 from django.core.exceptions import FieldError
 from django.db import connection
 from django.db.models import (
-    F, Aggregate, Avg, Count, DecimalField, FloatField, Func, IntegerField,
+    Aggregate, Avg, Count, DecimalField, F, FloatField, Func, IntegerField,
     Max, Min, Sum, Value,
 )
 from django.test import TestCase, ignore_warnings
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py
index 0674d99..0d15b4a 100644
--- a/tests/aggregation_regress/tests.py
+++ b/tests/aggregation_regress/tests.py
@@ -8,7 +8,7 @@ from operator import attrgetter
 from django.contrib.contenttypes.models import ContentType
 from django.core.exceptions import FieldError
 from django.db.models import (
-    F, Q, Avg, Count, Max, StdDev, Sum, Value, Variance,
+    Avg, Count, F, Max, Q, StdDev, Sum, Value, Variance,
 )
 from django.test import TestCase, skipUnlessDBFeature
 from django.test.utils import Approximate
diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
index ce9ffe6..72f9c1e 100644
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -5,7 +5,7 @@ from decimal import Decimal
 
 from django.core.exceptions import FieldDoesNotExist, FieldError
 from django.db.models import (
-    F, BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, Func,
+    BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, F, Func,
     IntegerField, Sum, Value,
 )
 from django.test import TestCase
diff --git a/tests/cache/tests.py b/tests/cache/tests.py
index e8ae19d..c2de5d5 100644
--- a/tests/cache/tests.py
+++ b/tests/cache/tests.py
@@ -1326,7 +1326,7 @@ class DefaultNonExpiringCacheKeyTests(TestCase):
         self.assertIsNotNone(cache._expire_info[cache_key])
 
     @override_settings(CACHES=NEVER_EXPIRING_CACHES_SETTINGS)
-    def text_caches_set_with_timeout_as_none_set_non_expiring_key(self):
+    def test_caches_set_with_timeout_as_none_set_non_expiring_key(self):
         """Memory caches that have the TIMEOUT parameter set to `None` will set
         a non expiring key by default.
         """
diff --git a/tests/delete/tests.py b/tests/delete/tests.py
index a2b910f..ce79efd 100644
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -8,8 +8,8 @@ from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
 from django.utils.six.moves import range
 
 from .models import (
-    A, M, MR, R, S, T, Avatar, Base, Child, HiddenUser, HiddenUserProfile,
-    M2MFrom, M2MTo, MRNull, Parent, RChild, User, create_a, get_default_r,
+    MR, A, Avatar, Base, Child, HiddenUser, HiddenUserProfile, M, M2MFrom,
+    M2MTo, MRNull, Parent, R, RChild, S, T, User, create_a, get_default_r,
 )
 
 
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
index 2d8b17d..9ff61ba 100644
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -11,7 +11,7 @@ from django.db.models.aggregates import (
     Avg, Count, Max, Min, StdDev, Sum, Variance,
 )
 from django.db.models.expressions import (
-    F, Case, Col, Date, DateTime, ExpressionWrapper, Func, OrderBy, Random,
+    Case, Col, Date, DateTime, ExpressionWrapper, F, Func, OrderBy, Random,
     RawSQL, Ref, Value, When,
 )
 from django.db.models.functions import (
diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py
index 001e7f5..a29e3bf 100644
--- a/tests/expressions_case/tests.py
+++ b/tests/expressions_case/tests.py
@@ -8,7 +8,7 @@ from uuid import UUID
 
 from django.core.exceptions import FieldError
 from django.db import connection, models
-from django.db.models import F, Q, Max, Min, Sum, Value
+from django.db.models import F, Max, Min, Q, Sum, Value
 from django.db.models.expressions import Case, When
 from django.test import TestCase
 from django.utils import six
diff --git a/tests/file_uploads/tests.py b/tests/file_uploads/tests.py
index 4888ca5..d8d9643 100644
--- a/tests/file_uploads/tests.py
+++ b/tests/file_uploads/tests.py
@@ -174,6 +174,41 @@ class FileUploadTests(TestCase):
         response = self.client.request(**r)
         self.assertEqual(response.status_code, 200)
 
+    def test_blank_filenames(self):
+        """
+        Receiving file upload when filename is blank (before and after
+        sanitization) should be okay.
+        """
+        # The second value is normalized to an empty name by
+        # MultiPartParser.IE_sanitize()
+        filenames = ['', 'C:\\Windows\\']
+
+        payload = client.FakePayload()
+        for i, name in enumerate(filenames):
+            payload.write('\r\n'.join([
+                '--' + client.BOUNDARY,
+                'Content-Disposition: form-data; name="file%s"; filename="%s"' % (i, name),
+                'Content-Type: application/octet-stream',
+                '',
+                'You got pwnd.\r\n'
+            ]))
+        payload.write('\r\n--' + client.BOUNDARY + '--\r\n')
+
+        r = {
+            'CONTENT_LENGTH': len(payload),
+            'CONTENT_TYPE': client.MULTIPART_CONTENT,
+            'PATH_INFO': '/echo/',
+            'REQUEST_METHOD': 'POST',
+            'wsgi.input': payload,
+        }
+        response = self.client.request(**r)
+        self.assertEqual(response.status_code, 200)
+
+        # Empty filenames should be ignored
+        received = json.loads(response.content.decode('utf-8'))
+        for i, name in enumerate(filenames):
+            self.assertIsNone(received.get('file%s' % i))
+
     def test_dangerous_file_names(self):
         """Uploaded file names should be sanitized before ever reaching the view."""
         # This test simulates possible directory traversal attacks by a
diff --git a/tests/generic_relations_regress/tests.py b/tests/generic_relations_regress/tests.py
index 0d78223..1253c4c 100644
--- a/tests/generic_relations_regress/tests.py
+++ b/tests/generic_relations_regress/tests.py
@@ -5,7 +5,7 @@ from django.forms.models import modelform_factory
 from django.test import TestCase, skipIfDBFeature
 
 from .models import (
-    A, B, C, D, Address, Board, CharLink, Company, Contact, Content, Developer,
+    A, Address, B, Board, C, CharLink, Company, Contact, Content, D, Developer,
     Guild, HasLinkThing, Link, Node, Note, OddRelation1, OddRelation2,
     Organization, Person, Place, Related, Restaurant, Tag, Team, TextLink,
 )
diff --git a/tests/gis_tests/test_measure.py b/tests/gis_tests/test_measure.py
index 771c10f..4a7ca99 100644
--- a/tests/gis_tests/test_measure.py
+++ b/tests/gis_tests/test_measure.py
@@ -5,7 +5,7 @@ and conversions. Here are some tests.
 
 import unittest
 
-from django.contrib.gis.measure import A, D, Area, Distance
+from django.contrib.gis.measure import A, Area, D, Distance
 
 
 class DistanceTest(unittest.TestCase):
diff --git a/tests/model_fields/test_durationfield.py b/tests/model_fields/test_durationfield.py
index fece35d..16a84a3 100644
--- a/tests/model_fields/test_durationfield.py
+++ b/tests/model_fields/test_durationfield.py
@@ -22,6 +22,12 @@ class TestSaveLoad(TestCase):
         loaded = NullDurationModel.objects.get()
         self.assertEqual(loaded.field, None)
 
+    def test_fractional_seconds(self):
+        value = datetime.timedelta(seconds=2.05)
+        d = DurationModel.objects.create(field=value)
+        d.refresh_from_db()
+        self.assertEqual(d.field, value)
+
 
 class TestQuerying(TestCase):
 
diff --git a/tests/model_inheritance/tests.py b/tests/model_inheritance/tests.py
index d11f50d..1649318 100644
--- a/tests/model_inheritance/tests.py
+++ b/tests/model_inheritance/tests.py
@@ -226,10 +226,8 @@ class ModelInheritanceDataTests(TestCase):
 
     def test_inherited_multiple_objects_returned_exception(self):
         # MultipleObjectsReturned is also inherited.
-        self.assertRaises(
-            Place.MultipleObjectsReturned,
-            Restaurant.objects.get, id__lt=12321
-        )
+        with self.assertRaises(Place.MultipleObjectsReturned):
+            Restaurant.objects.get()
 
     def test_related_objects_for_inherited_models(self):
         # Related objects work just as they normally do.
diff --git a/tests/queries/tests.py b/tests/queries/tests.py
index 5ebcc17..1f9fec7 100644
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -9,7 +9,7 @@ from operator import attrgetter
 
 from django.core.exceptions import FieldError
 from django.db import DEFAULT_DB_ALIAS, connection
-from django.db.models import F, Q, Count
+from django.db.models import Count, F, Q
 from django.db.models.sql.constants import LOUTER
 from django.db.models.sql.datastructures import EmptyResultSet
 from django.db.models.sql.where import EverythingNode, NothingNode, WhereNode
@@ -20,7 +20,7 @@ from django.utils.deprecation import RemovedInDjango19Warning
 from django.utils.six.moves import range
 
 from .models import (
-    FK1, X, Annotation, Article, Author, BaseA, Book, CategoryItem,
+    FK1, Annotation, Article, Author, BaseA, Book, CategoryItem,
     CategoryRelationship, Celebrity, Channel, Chapter, Child, ChildObjectA,
     Classroom, Company, Cover, CustomPk, CustomPkTag, Detail, DumbCategory,
     Eaten, Employment, ExtraInfo, Fan, Food, Identifier, Individual, Item, Job,
@@ -32,7 +32,7 @@ from .models import (
     RelatedIndividual, RelatedObject, Report, ReservedName, Responsibility,
     School, SharedConnection, SimpleCategory, SingleObject, SpecialCategory,
     Staff, StaffUser, Student, Tag, Task, Ticket21203Child, Ticket21203Parent,
-    Ticket23605A, Ticket23605B, Ticket23605C, TvChef, Valid,
+    Ticket23605A, Ticket23605B, Ticket23605C, TvChef, Valid, X,
 )
 
 
diff --git a/tests/select_related_regress/tests.py b/tests/select_related_regress/tests.py
index d014123..74cc93f 100644
--- a/tests/select_related_regress/tests.py
+++ b/tests/select_related_regress/tests.py
@@ -4,7 +4,7 @@ from django.test import TestCase
 from django.utils import six
 
 from .models import (
-    A, B, C, Building, Chick, Child, Class, Client, ClientStatus, Connection,
+    A, B, Building, C, Chick, Child, Class, Client, ClientStatus, Connection,
     Country, Device, Enrollment, Hen, Item, Organizer, Person, Port,
     SpecialClient, State, Student, TUser,
 )
diff --git a/tests/signing/tests.py b/tests/signing/tests.py
index 006151b..e16cb4c 100644
--- a/tests/signing/tests.py
+++ b/tests/signing/tests.py
@@ -57,7 +57,7 @@ class TestSigner(TestCase):
             self.assertNotEqual(force_str(example), signed)
             self.assertEqual(example, signer.unsign(signed))
 
-    def unsign_detects_tampering(self):
+    def test_unsign_detects_tampering(self):
         "unsign should raise an exception if the value has been tampered with"
         signer = signing.Signer('predictable-secret')
         value = 'Another string'
diff --git a/tests/update/tests.py b/tests/update/tests.py
index 1ed316c..010151d 100644
--- a/tests/update/tests.py
+++ b/tests/update/tests.py
@@ -2,7 +2,7 @@ from __future__ import unicode_literals
 
 from django.test import TestCase
 
-from .models import A, B, D, Bar, DataPoint, Foo, RelatedPoint
+from .models import A, B, Bar, D, DataPoint, Foo, RelatedPoint
 
 
 class SimpleTest(TestCase):

-- 
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