Ticket #13361: 13361_r12995.diff

File 13361_r12995.diff, 2.4 KB (added by Carl Meyer, 15 years ago)
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    a b  
    271271    def _media(self):
    272272        from django.conf import settings
    273273
    274         js = ['js/core.js', 'js/admin/RelatedObjectLookups.js']
     274        js = ['js/core.js', 'js/admin/RelatedObjectLookups.js',
     275              'js/jquery.min.js', 'js/jquery.init.js']
    275276        if self.actions is not None:
    276             js.extend(['js/jquery.min.js', 'js/jquery.init.js', 'js/actions.min.js'])
     277            js.extend(['js/actions.min.js'])
    277278        if self.prepopulated_fields:
    278279            js.append('js/urlify.js')
    279280            js.append('js/prepopulate.min.js')
  • docs/ref/contrib/admin/index.txt

    diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
    a b  
    938938Keep in mind that this will be prepended with ``MEDIA_URL``. The same rules
    939939apply as :ref:`regular media definitions on forms <topics-forms-media>`.
    940940
     941Django admin Javascript makes use of the `jQuery`_ library. To avoid
     942conflict with user scripts, Django's jQuery is namespaced as
     943``django.jQuery``. If you want to use jQuery in your own admin
     944JavaScript without including a second copy, you can use the
     945``django.jQuery`` object on changelist and add/edit views.
     946
     947.. _jQuery: http://jquery.com
     948
    941949Adding custom validation to the admin
    942950-------------------------------------
    943951
  • tests/regressiontests/admin_views/tests.py

    diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
    a b  
    13861386        self.assert_('action-checkbox-column' not in response.content,
    13871387            "Found unexpected action-checkbox-column class in response")
    13881388
     1389    def test_model_without_action_still_has_jquery(self):
     1390        "Tests that a ModelAdmin without any actions still gets jQuery included in page"
     1391        response = self.client.get('/test_admin/admin/admin_views/oldsubscriber/')
     1392        self.assertEquals(response.context["action_form"], None)
     1393        self.assert_('jquery.min.js' in response.content,
     1394            "jQuery missing from admin pages for model with no admin actions"
     1395        )
     1396
    13891397    def test_action_column_class(self):
    13901398        "Tests that the checkbox column class is present in the response"
    13911399        response = self.client.get('/test_admin/admin/admin_views/subscriber/')
Back to Top