Ticket #8058: 8058.patch

File 8058.patch, 1.9 KB (added by Collin Grady, 16 years ago)
  • django/contrib/admin/options.py

     
    198198            js.append('js/urlify.js')
    199199        if self.opts.get_ordered_objects():
    200200            js.extend(['js/getElementsBySelector.js', 'js/dom-drag.js' , 'js/admin/ordering.js'])
    201         if self.filter_vertical or self.filter_horizontal:
    202             js.extend(['js/SelectBox.js' , 'js/SelectFilter2.js'])
    203201
    204202        return forms.Media(js=['%s%s' % (settings.ADMIN_MEDIA_PREFIX, url) for url in js])
    205203    media = property(_media)
  • django/contrib/admin/widgets.py

     
    1717    """
    1818    A SelectMultiple with a JavaScript filter interface.
    1919
    20     Note that the resulting JavaScript assumes that the SelectFilter2.js
    21     library and its dependencies have been loaded in the HTML page.
     20    Note that the resulting JavaScript assumes that the jsi18n
     21    catalog has been loaded in the page
    2222    """
     23    class Media:
     24        js = (settings.ADMIN_MEDIA_PREFIX + "js/core.js",
     25              settings.ADMIN_MEDIA_PREFIX + "js/SelectBox.js",
     26              settings.ADMIN_MEDIA_PREFIX + "js/SelectFilter2.js")
     27
    2328    def __init__(self, verbose_name, is_stacked, attrs=None, choices=()):
    2429        self.verbose_name = verbose_name
    2530        self.is_stacked = is_stacked
     
    182187        memo[id(self)] = obj
    183188        return obj
    184189
     190    def _media(self):
     191        return self.widget.media
     192    media = property(_media)
     193
    185194    def render(self, name, value, *args, **kwargs):
    186195        rel_to = self.rel.to
    187196        related_url = '../../../%s/%s/' % (rel_to._meta.app_label, rel_to._meta.object_name.lower())
Back to Top