Ticket #2943: patch_to_admin_modify.diff

File patch_to_admin_modify.diff, 1.0 KB (added by mtsuyuki@…, 9 years ago)
  • admin_modify.py

     
    77from django.db.models.related import BoundRelatedObject
    88from django.conf import settings
    99import re
     10import string
    1011
    1112register = template.Library()
    1213
     
    197198    f = bound_field.field
    198199    if f.rel and isinstance(f.rel, models.ManyToManyRel) and f.rel.filter_interface:
    199200        return '<script type="text/javascript">addEvent(window, "load", function(e) {' \
    200               ' SelectFilter.init("id_%s", %r, %s, "%s"); });</script>\n' % (
    201               f.name, f.verbose_name, f.rel.filter_interface-1, settings.ADMIN_MEDIA_PREFIX)
     201              ' SelectFilter.init("id_%s", "%s", %s, "%s"); });</script>\n' % (
     202              f.name, string.replace(f.verbose_name, '"', '\\"'), f.rel.filter_interface-1, settings.ADMIN_MEDIA_PREFIX)
    202203    else:
    203204        return ''
    204205filter_interface_script_maybe = register.simple_tag(filter_interface_script_maybe)
Back to Top