Ticket #9739: patch9739.diff

File patch9739.diff, 3.3 KB (added by Ridley Larsen, 10 years ago)

patch against a2e56db

  • AUTHORS

    diff --git a/AUTHORS b/AUTHORS
    index 268f5a2..cd93da0 100644
    a b answer newbie questions, and generally made Django that much better:  
    586586    Richard Davies <richard.davies@elastichosts.com>
    587587    Richard House <Richard.House@i-logue.com>
    588588    Rick Wagner <rwagner@physics.ucsd.edu>
     589    Ridley Larsen <ridley@velocitywebworks.com>
    589590    Robert Coup
    590591    Robert Myers <myer0052@gmail.com>
    591592    Roberto Aguilar <roberto@baremetal.io>
  • django/forms/widgets.py

    diff --git a/django/forms/widgets.py b/django/forms/widgets.py
    index 4f38418..dfa18c6 100644
    a b class SplitDateTimeWidget(MultiWidget):  
    891891
    892892    def decompress(self, value):
    893893        if value:
    894             value = to_current_timezone(value)
     894            if isinstance(value, six.string_types):
     895                return value.split(',')
     896            else:
     897                value = to_current_timezone(value)
    895898            return [value.date(), value.time().replace(microsecond=0)]
    896899        return [None, None]
    897900
  • docs/ref/contrib/admin/index.txt

    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
    index 4b11fed..c947d2e 100644
    a b templates used by the :class:`ModelAdmin` views:  
    17361736    A hook for the initial data on admin change forms. By default, fields are
    17371737    given initial values from ``GET`` parameters. For instance,
    17381738    ``?name=initial_value`` will set the ``name`` field's initial value to be
    1739     ``initial_value``.
     1739    ``initial_value``. ManyToManyFields can be populated with a comma-separated
     1740    list of PKs, and DateTimeFields can be populated with comma-separated
     1741    date, time.
    17401742
    17411743    This method should return a dictionary in the form
    17421744    ``{'fieldname': 'fieldval'}``::
  • tests/admin_views/tests.py

    diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py
    index 8ead8ee..98e3e85 100644
    a b class PrePopulatedTest(TestCase):  
    43314331        response = self.client.get(reverse('admin:admin_views_prepopulatedpostlargeslug_add'))
    43324332        self.assertContains(response, "maxLength: 1000")  # instead of 1,000
    43334333
     4334    def test_changeform_intial_data(self):
     4335        """
     4336        Regression test for #9739
     4337        Tests the prepopulation of fields within the admin site.
     4338        """
     4339        # Add sections for testing <select>.
     4340        s1 = Section.objects.create(name='Section 1')
     4341        # Prepopulate the Article add page with GET data.
     4342        querystring = '?title=TestTitle&content=Lorem%20Ipsum&date=2011-06-01,18:21:53&section=1'
     4343        response = self.client.get(
     4344            reverse('admin:admin_views_article_add') + querystring
     4345        )
     4346        self.assertEqual(response.status_code, 200)
     4347        # test if the prepopulated values are within the response and in the correct fields
     4348        self.assertContains(response, text='value="TestTitle"')
     4349        self.assertContains(response, text='Lorem Ipsum')
     4350        self.assertContains(response, text='value="2011-06-01"')
     4351        self.assertContains(response, text='value="18:21:53"')
     4352        self.assertContains(response, text='<option value="%s" selected="selected">' % (s1.pk))
     4353
    43344354
    43354355@override_settings(PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
    43364356    ROOT_URLCONF="admin_views.urls")
Back to Top