Ticket #7028: ticket7028-7.patch

File ticket7028-7.patch, 22.9 KB (added by mrts, 15 years ago)

The clearing button only appears if an object is present, next to it. Commit: http://github.com/mrts/django/commit/267b1fea2518b2a39c35708b21b39ebeb069b0ee

  • AUTHORS

    diff --git a/AUTHORS b/AUTHORS
    index 55211a6..d3ad681 100644
    a b answer newbie questions, and generally made Django that much better:  
    6969    Esdras Beleza <linux@esdrasbeleza.com>
    7070    Chris Bennett <chrisrbennett@yahoo.com>
    7171    James Bennett
     72    Marco Beri <marcoberi@gmail.com>
    7273    Julian Bez
    7374    Arvis Bickovskis <viestards.lists@gmail.com>
    7475    Natalia Bidart
  • django/contrib/admin/media/js/admin/RelatedObjectLookups.js

    diff --git a/django/contrib/admin/media/js/admin/RelatedObjectLookups.js b/django/contrib/admin/media/js/admin/RelatedObjectLookups.js
    index 1bc78f8..a954eb8 100644
    a b function html_unescape(text) {  
    1111    return text;
    1212}
    1313
     14function html_escape(text) {
     15    text = text.replace(/&/g, '&amp;');
     16    text = text.replace(/</g, '&lt;');
     17    text = text.replace(/>/g, '&gt;');
     18    text = text.replace(/"/g, '&quot;');
     19    text = text.replace(/'/g, '&#39;');
     20    return text;
     21}
     22
    1423// IE doesn't accept periods or dashes in the window name, but the element IDs
    1524// we use to generate popup window names may contain them, therefore we map them
    16 // to allowed characters in a reversible way so that we can locate the correct 
     25// to allowed characters in a reversible way so that we can locate the correct
    1726// element when the popup window is dismissed.
    1827function id_to_windowname(text) {
    1928    text = text.replace(/\./g, '__dot__');
    function windowname_to_id(text) {  
    2736    return text;
    2837}
    2938
     39function getAdminMediaPrefix() {
     40    // Deduce admin_media_prefix by looking at the <script>s in the
     41    // current document and finding the URL of *this* module.
     42    // Copy-paste from DateTimeShortcuts.js, makes sense as a
     43    // separate function in core.js.
     44    var scripts = document.getElementsByTagName('script');
     45
     46    for (var i=0; i < scripts.length; i++) {
     47        if (scripts[i].src.match(/RelatedObjectLookups/)) {
     48            var idx = scripts[i].src.indexOf('js/admin/RelatedObjectLookups');
     49            return scripts[i].src.substring(0, idx);
     50        }
     51    }
     52    // poor man's assert
     53    alert('This line is unreachable. Please file a bug if you see this message.');
     54}
     55
     56var CLEAR_RAW_ID = '<a href="#" onclick="return clearRawId(this);">' +
     57'<img src="' + getAdminMediaPrefix() + 'img/admin/icon_deletelink.gif" ' +
     58'width="10" height="10" alt="Clear" title="Clear" /></a>';
     59
     60// FIXME: the following produce 'gettext is not defined' errors in FireBug.
     61// Needs to be tracked down.
     62// (jsi18n is generally included before this in admin templates)
     63//
     64// 'width="10" height="10" alt="' + gettext('Clear') + '" title="' +
     65// gettext('Clear') + '" /></a>';
     66
     67function showRelatedObjectPopup(triggeringLink) {
     68    var name = triggeringLink.parentNode.id.replace(/^view_lookup_/, '');
     69    name = id_to_windowname(name);
     70    return openPopupWindow(triggeringLink.href, '_popup', name);
     71}
     72
    3073function showRelatedObjectLookupPopup(triggeringLink) {
    3174    var name = triggeringLink.id.replace(/^lookup_/, '');
    3275    name = id_to_windowname(name);
    33     var href;
    34     if (triggeringLink.href.search(/\?/) >= 0) {
    35         href = triggeringLink.href + '&pop=1';
    36     } else {
    37         href = triggeringLink.href + '?pop=1';
    38     }
    39     var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
    40     win.focus();
    41     return false;
     76    return openPopupWindow(triggeringLink.href, 'pop', name);
    4277}
    4378
    44 function dismissRelatedLookupPopup(win, chosenId) {
     79function dismissRelatedLookupPopup(win, chosenId, chosenIdHref, chosenName) {
    4580    var name = windowname_to_id(win.name);
    4681    var elem = document.getElementById(name);
     82    var nameElem = document.getElementById("view_lookup_" + name);
     83
    4784    if (elem.className.indexOf('vManyToManyRawIdAdminField') != -1 && elem.value) {
    4885        elem.value += ',' + chosenId;
    4986    } else {
    5087        document.getElementById(name).value = chosenId;
    5188    }
     89
     90    if (nameElem) {
     91      nameElem.innerHTML = '<a href="' + chosenIdHref + '" ' +
     92       'onclick="return showRelatedObjectPopup(this);">' +
     93        html_escape(chosenName) + '</a> ' + CLEAR_RAW_ID;
     94    }
     95
    5296    win.close();
    5397}
    5498
    5599function showAddAnotherPopup(triggeringLink) {
    56100    var name = triggeringLink.id.replace(/^add_/, '');
    57101    name = id_to_windowname(name);
    58     href = triggeringLink.href
    59     if (href.indexOf('?') == -1) {
    60         href += '?_popup=1';
    61     } else {
    62         href  += '&_popup=1';
    63     }
    64     var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
    65     win.focus();
    66     return false;
     102    return openPopupWindow(triggeringLink.href, '_popup', name);
    67103}
    68104
    69105function dismissAddAnotherPopup(win, newId, newRepr) {
    70106    // newId and newRepr are expected to have previously been escaped by
    71107    // django.utils.html.escape.
    72108    newId = html_unescape(newId);
     109    var newRepr_escaped = newRepr;
    73110    newRepr = html_unescape(newRepr);
    74111    var name = windowname_to_id(win.name);
    75112    var elem = document.getElementById(name);
    function dismissAddAnotherPopup(win, newId, newRepr) {  
    84121            } else {
    85122                elem.value = newId;
    86123            }
     124
     125            var nameElem = document.getElementById("view_lookup_" + name);
     126            if (nameElem) {
     127                var chosenIdHref = win.location.href.replace(/\/add\/[^\/]*$/,
     128                    '/' + newId + '/');
     129                nameElem.innerHTML = '<a href="' + chosenIdHref + '" ' +
     130                  'onclick="return showRelatedObjectPopup(this);">' +
     131                  newRepr_escaped + '</a> ' + CLEAR_RAW_ID;
     132            }
    87133        }
    88134    } else {
    89135        var toId = name + "_to";
    function dismissAddAnotherPopup(win, newId, newRepr) {  
    94140    }
    95141    win.close();
    96142}
     143
     144function clearRawId(triggeringLink) {
     145    triggeringLink.parentNode.previousSibling.previousSibling.previousSibling.previousSibling.value = '';
     146    triggeringLink.parentNode.innerHTML = '';
     147    return false;
     148}
     149
     150function openPopupWindow(href, popup_var, name) {
     151    if (href.indexOf('?') == -1) {
     152        href += '?';
     153    } else {
     154        href  += '&';
     155    }
     156    href += popup_var + '=1';
     157    var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes');
     158    win.focus();
     159    return false;
     160}
  • django/contrib/admin/options.py

    diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
    index 8f68eb1..140b79c 100644
    a b from django.forms.models import BaseInlineFormSet  
    55from django.contrib.contenttypes.models import ContentType
    66from django.contrib.admin import widgets
    77from django.contrib.admin import helpers
    8 from django.contrib.admin.util import unquote, flatten_fieldsets, get_deleted_objects, model_ngettext, model_format_dict
     8from django.contrib.admin.util import unquote, flatten_fieldsets, get_deleted_objects, model_ngettext, model_format_dict, obj_label, get_related_url
    99from django.contrib import messages
    1010from django.views.decorators.csrf import csrf_protect
    1111from django.core.exceptions import PermissionDenied, ValidationError
    class ModelAdmin(BaseModelAdmin):  
    674674                return HttpResponseRedirect(request.path + "?_popup=1")
    675675            else:
    676676                return HttpResponseRedirect(request.path)
     677        elif request.POST.has_key("_popup"):
     678            # object changed via raw id link popup
     679            obj_id = repr(force_unicode(obj._get_pk_val()))[1:]
     680            obj_url = get_related_url(obj, obj.pk)
     681            label = obj_label(obj).replace("&#39;", r"\'")
     682            return HttpResponse('<script type="text/javascript">opener.dismissRelatedLookupPopup('
     683            "window, %s, '%s', '%s');</script>" % (obj_id, obj_url, label))
    677684        elif request.POST.has_key("_saveasnew"):
    678685            msg = _('The %(name)s "%(obj)s" was added successfully. You may edit it again below.') % {'name': force_unicode(opts.verbose_name), 'obj': obj}
    679686            self.message_user(request, msg)
  • django/contrib/admin/templatetags/admin_list.py

    diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
    index 7cd3f0a..bf8fba2 100644
    a b from django.conf import settings  
    44from django.contrib.admin.util import lookup_field, display_for_field, label_for_field
    55from django.contrib.admin.views.main import ALL_VAR, EMPTY_CHANGELIST_VALUE
    66from django.contrib.admin.views.main import ORDER_VAR, ORDER_TYPE_VAR, PAGE_VAR, SEARCH_VAR
     7from django.contrib.admin.util import obj_label, get_related_url
    78from django.core.exceptions import ObjectDoesNotExist
    89from django.db import models
    910from django.forms.forms import pretty_name
    def items_for_result(cl, result, form):  
    166167                attr = pk
    167168            value = result.serializable_value(attr)
    168169            result_id = repr(force_unicode(value))[1:]
    169             yield mark_safe(u'<%s%s><a href="%s"%s>%s</a></%s>' % \
    170                 (table_tag, row_class, url, (cl.is_popup and ' onclick="opener.dismissRelatedLookupPopup(window, %s); return false;"' % result_id or ''), conditional_escape(result_repr), table_tag))
     170            result_name = obj_label(result)
     171            result_url = get_related_url(result, result.pk)
     172            yield mark_safe(u'<%s%s><a href="%s"%s>%s</a></%s>' %
     173                (table_tag, row_class, url,
     174                    (cl.is_popup
     175                        and ' onclick="opener.dismissRelatedLookupPopup('
     176                            "window, %s, '%s', '%s'); return false;\"" %
     177                            (result_id, result_url,
     178                                result_name.replace("&#39;", r"\'"))
     179                        or ''),
     180                    conditional_escape(result_repr), table_tag))
    171181        else:
    172182            # By default the fields come from ModelAdmin.list_editable, but if we pull
    173183            # the fields out of the form instead of list_editable custom admins
  • django/contrib/admin/util.py

    diff --git a/django/contrib/admin/util.py b/django/contrib/admin/util.py
    index d252a80..dbaea60 100644
    a b from django.db import models  
    33from django.utils import formats
    44from django.utils.html import escape
    55from django.utils.safestring import mark_safe
    6 from django.utils.text import capfirst
     6from django.utils.text import capfirst, truncate_words
    77from django.utils.encoding import force_unicode, smart_unicode, smart_str
    88from django.utils.translation import ungettext, ugettext as _
    99from django.core.urlresolvers import reverse, NoReverseMatch
    def display_for_field(value, field):  
    305305        return formats.number_format(value)
    306306    else:
    307307        return smart_unicode(value)
     308
     309def get_related_url(rel_to, action=None, admin_site=None):
     310    reverse_path = 'admin:%s_%s'
     311    rel_path = '%s%s/%s/'
     312    params = [rel_to._meta.app_label, rel_to._meta.object_name.lower()]
     313
     314    if action:
     315        reverse_path += '_%s'
     316        rel_path += '%s/'
     317        params.append(action)
     318
     319    if admin_site:
     320        try:
     321            return reverse(reverse_path % tuple(params),
     322                    current_app=admin_site.name)
     323        except NoReverseMatch:
     324            params.insert(0, admin_site.root_path)
     325            return rel_path % tuple(params)
     326
     327    params.insert(0, '../../../')
     328    return rel_path % tuple(params)
     329
     330def obj_label(obj):
     331    return escape(truncate_words(obj, 7))
  • django/contrib/admin/widgets.py

    diff --git a/django/contrib/admin/widgets.py b/django/contrib/admin/widgets.py
    index 120df94..2a788ee 100644
    a b import django.utils.copycompat as copy  
    77from django import forms
    88from django.forms.widgets import RadioFieldRenderer
    99from django.forms.util import flatatt
    10 from django.utils.html import escape
    11 from django.utils.text import truncate_words
    1210from django.utils.translation import ugettext as _
    1311from django.utils.safestring import mark_safe
    1412from django.utils.encoding import force_unicode
    1513from django.conf import settings
    16 from django.core.urlresolvers import reverse, NoReverseMatch
     14from django.contrib.admin.util import get_related_url, obj_label
    1715
    1816class FilteredSelectMultiple(forms.SelectMultiple):
    1917    """
    class ForeignKeyRawIdWidget(forms.TextInput):  
    110108    def render(self, name, value, attrs=None):
    111109        if attrs is None:
    112110            attrs = {}
    113         related_url = '../../../%s/%s/' % (self.rel.to._meta.app_label, self.rel.to._meta.object_name.lower())
     111        related_url = get_related_url(self.rel.to)
    114112        params = self.url_parameters()
    115113        if params:
    116114            url = '?' + '&amp;'.join(['%s=%s' % (k, v) for k, v in params.items()])
    class ForeignKeyRawIdWidget(forms.TextInput):  
    121119        output = [super(ForeignKeyRawIdWidget, self).render(name, value, attrs)]
    122120        # TODO: "id_" is hard-coded here. This should instead use the correct
    123121        # API to determine the ID dynamically.
    124         output.append('<a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % \
     122        output.append(' <a href="%s%s" class="related-lookup" id="lookup_id_%s" onclick="return showRelatedObjectLookupPopup(this);"> ' % \
    125123            (related_url, url, name))
    126         output.append('<img src="%simg/admin/selector-search.gif" width="16" height="16" alt="%s" /></a>' % (settings.ADMIN_MEDIA_PREFIX, _('Lookup')))
    127         if value:
    128             output.append(self.label_for_value(value))
     124        output.append('<img src="%(prefix)simg/admin/selector-search.gif" width="16" height="16" alt="%(title)s" title="%(title)s" /></a>' % {'prefix': settings.ADMIN_MEDIA_PREFIX, 'title': _('Lookup')})
     125        output.append(self.label_for_value(value, 'view_lookup_id_%s' % name))
    129126        return mark_safe(u''.join(output))
    130127
    131128    def base_url_parameters(self):
    class ForeignKeyRawIdWidget(forms.TextInput):  
    147144        params.update({TO_FIELD_VAR: self.rel.get_related_field().name})
    148145        return params
    149146
    150     def label_for_value(self, value):
    151         key = self.rel.get_related_field().name
    152         obj = self.rel.to._default_manager.using(self.db).get(**{key: value})
    153         return '&nbsp;<strong>%s</strong>' % escape(truncate_words(obj, 14))
     147    def label_for_value(self, value, name):
     148        if value:
     149            key = self.rel.get_related_field().name
     150            obj = self.rel.to._default_manager.using(
     151                    self.db).get(**{key: value})
     152            related_url = get_related_url(obj, obj.pk)
     153            return (' <strong id="%(name)s"><a href="%(url)s" '
     154                    'onclick="return showRelatedObjectPopup(this);">%(label)s</a> '
     155                    '<a href="#" onclick="return clearRawId(this);">'
     156                    '<img src="%(prefix)simg/admin/icon_deletelink.gif" '
     157                    'width="10" height="10" alt="%(clear)s" title="%(clear)s" />'
     158                    '</a></strong>' % {'name': name, 'url': related_url,
     159                        'label': obj_label(obj),
     160                        'prefix': settings.ADMIN_MEDIA_PREFIX,
     161                        'clear': _("Clear"),}
     162                    )
     163        else:
     164            # a placeholder that will be filled in
     165            # JavaScript dismissRelatedLookupPopup()
     166            return ' <strong id="%s"></strong>' % name
    154167
    155168class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):
    156169    """
    class ManyToManyRawIdWidget(ForeignKeyRawIdWidget):  
    171184    def url_parameters(self):
    172185        return self.base_url_parameters()
    173186
    174     def label_for_value(self, value):
     187    def label_for_value(self, value, name):
    175188        return ''
    176189
    177190    def value_from_datadict(self, data, files, name):
    class RelatedFieldWidgetWrapper(forms.Widget):  
    221234    media = property(_media)
    222235
    223236    def render(self, name, value, *args, **kwargs):
    224         rel_to = self.rel.to
    225         info = (rel_to._meta.app_label, rel_to._meta.object_name.lower())
    226         try:
    227             related_url = reverse('admin:%s_%s_add' % info, current_app=self.admin_site.name)
    228         except NoReverseMatch:
    229             info = (self.admin_site.root_path, rel_to._meta.app_label, rel_to._meta.object_name.lower())
    230             related_url = '%s%s/%s/add/' % info
    231237        self.widget.choices = self.choices
    232238        output = [self.widget.render(name, value, *args, **kwargs)]
     239        rel_to = self.rel.to
    233240        if rel_to in self.admin_site._registry: # If the related object has an admin interface:
     241            related_url = get_related_url(rel_to, 'add', self.admin_site)
    234242            # TODO: "id_" is hard-coded here. This should instead use the correct
    235243            # API to determine the ID dynamically.
    236244            output.append(u'<a href="%s" class="add-another" id="add_id_%s" onclick="return showAddAnotherPopup(this);"> ' % \
  • tests/regressiontests/admin_widgets/models.py

    diff --git a/tests/regressiontests/admin_widgets/models.py b/tests/regressiontests/admin_widgets/models.py
    index b9fe67c..e997e1a 100644
    a b from django.db import models  
    44from django.core.files.storage import default_storage
    55from django.contrib.auth.models import User
    66
    7 class MyFileField(models.FileField): 
    8     pass 
     7class MyFileField(models.FileField):
     8    pass
    99
    1010class Member(models.Model):
    1111    name = models.CharField(max_length=100)
    Currently: <a target="_blank" href="%(STORAGE_URL)salbums/hybrid_theory.jpg">alb  
    116116>>> rel = Album._meta.get_field('band').rel
    117117>>> w = ForeignKeyRawIdWidget(rel)
    118118>>> print conditional_escape(w.render('test', band.pk, attrs={}))
    119 <input type="text" name="test" value="1" class="vForeignKeyRawIdAdminField" /><a href="../../../admin_widgets/band/?t=id" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" /></a>&nbsp;<strong>Linkin Park</strong>
     119<input type="text" name="test" value="1" class="vForeignKeyRawIdAdminField" /> <a href="../../../admin_widgets/band/?t=id" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" title="Lookup" /></a> <strong id="view_lookup_id_test"><a href="../../../admin_widgets/band/1/" onclick="return showRelatedObjectPopup(this);">Linkin Park</a> <a href="#" onclick="return clearRawId(this);"><img src="%(ADMIN_MEDIA_PREFIX)simg/admin/icon_deletelink.gif" width="10" height="10" alt="Clear" title="Clear" /></a></strong>
    120120
    121121>>> m1 = Member.objects.create(pk=1, name='Chester')
    122122>>> m2 = Member.objects.create(pk=2, name='Mike')
    Currently: <a target="_blank" href="%(STORAGE_URL)salbums/hybrid_theory.jpg">alb  
    125125>>> rel = Band._meta.get_field('members').rel
    126126>>> w = ManyToManyRawIdWidget(rel)
    127127>>> print conditional_escape(w.render('test', [m1.pk, m2.pk], attrs={}))
    128 <input type="text" name="test" value="1,2" class="vManyToManyRawIdAdminField" /><a href="../../../admin_widgets/member/" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" /></a>
     128||| FIXME -- ManyToManyRawIdWidget has not been implemented |||
    129129>>> w._has_changed(None, None)
    130130False
    131131>>> w._has_changed([], None)
    True  
    147147>>> rel = Inventory._meta.get_field('parent').rel
    148148>>> w = ForeignKeyRawIdWidget(rel)
    149149>>> print w.render('test', core.parent_id, attrs={})
    150 <input type="text" name="test" value="86" class="vForeignKeyRawIdAdminField" /><a href="../../../admin_widgets/inventory/?t=barcode" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" /></a>&nbsp;<strong>Apple</strong>
     150<input type="text" name="test" value="86" class="vForeignKeyRawIdAdminField" /> <a href="../../../admin_widgets/inventory/?t=barcode" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" title="Lookup" /></a> <strong id="view_lookup_id_test"><a href="../../../admin_widgets/inventory/1/" onclick="return showRelatedObjectPopup(this);">Apple</a> <a href="#" onclick="return clearRawId(this);"><img src="%(ADMIN_MEDIA_PREFIX)simg/admin/icon_deletelink.gif" width="10" height="10" alt="Clear" title="Clear" /></a></strong>
    151151
    152152# see #9258
    153153>>> hidden = Inventory.objects.create(barcode=93, name='Hidden', hidden=True)
    154154>>> child_of_hidden = Inventory.objects.create(barcode=94, name='Child of hidden', parent=hidden)
    155155>>> print w.render('test', child_of_hidden.parent_id, attrs={})
    156 <input type="text" name="test" value="93" class="vForeignKeyRawIdAdminField" /><a href="../../../admin_widgets/inventory/?t=barcode" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" /></a>&nbsp;<strong>Hidden</strong>
     156<input type="text" name="test" value="93" class="vForeignKeyRawIdAdminField" /> <a href="../../../admin_widgets/inventory/?t=barcode" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" title="Lookup" /></a> <strong id="view_lookup_id_test"><a href="../../../admin_widgets/inventory/4/" onclick="return showRelatedObjectPopup(this);">Hidden</a> <a href="#" onclick="return clearRawId(this);"><img src="%(ADMIN_MEDIA_PREFIX)simg/admin/icon_deletelink.gif" width="10" height="10" alt="Clear" title="Clear" /></a></strong>
     157
     158>>> apostrophe = Inventory.objects.create(barcode=88, name="'Apostrophe', and <javascript> and a really really` really really really really really long one!")
     159>>> apostrophic_child = Inventory.objects.create(barcode=89, name="Apostrophe's child", parent=apostrophe)
     160>>> print w.render('test', apostrophic_child.parent_id, attrs={})
     161<input type="text" name="test" value="88" class="vForeignKeyRawIdAdminField" /> <a href="../../../admin_widgets/inventory/?t=barcode" class="related-lookup" id="lookup_id_test" onclick="return showRelatedObjectLookupPopup(this);"> <img src="%(ADMIN_MEDIA_PREFIX)simg/admin/selector-search.gif" width="16" height="16" alt="Lookup" title="Lookup" /></a> <strong id="view_lookup_id_test"><a href="../../../admin_widgets/inventory/6/" onclick="return showRelatedObjectPopup(this);">&#39;Apostrophe&#39;, and &lt;javascript&gt; and a really really` ...</a> <a href="#" onclick="return clearRawId(this);"><img src="%(ADMIN_MEDIA_PREFIX)simg/admin/icon_deletelink.gif" width="10" height="10" alt="Clear" title="Clear" /></a></strong>
    157162""" % {
    158163    'ADMIN_MEDIA_PREFIX': settings.ADMIN_MEDIA_PREFIX,
    159164    'STORAGE_URL': default_storage.url(''),
Back to Top