Ticket #620: admin_limit_choices.patch

File admin_limit_choices.patch, 2.5 KB (added by davidschein@…, 19 years ago)

patch

  • media/js/admin/RelatedObjectLookups.js

     
    33
    44function showRelatedObjectLookupPopup(triggeringLink) {
    55    var name = triggeringLink.id.replace(/^lookup_/, '');
    6     var win = window.open(triggeringLink.href + '?pop=1', name, 'height=500,width=740,resizable=yes,scrollbars=yes');
     6    //var win = window.open(triggeringLink.href + '?pop=1', name, 'height=500,width=740,resizable=yes,scrollbars=yes');
     7    var href
     8    if (triggeringLink.href.search(/\?/) >= 0) {
     9        href = triggeringLink.href + '&pop=1';
     10    } else {
     11        href = triggeringLink.href + '?pop=1'
     12    }
     13    var win = open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes');
     14
    715    win.focus();
    816    return false;
    917}
  • templates/widget/foreign.html

     
    11{% load admin_modify adminmedia %}
    22{% output_all bound_field.form_fields %}
    33{% if bound_field.raw_id_admin %}
     4{% if bound_field.field.rel.limit_choices_to %}
     5    <a href="../../../{{ bound_field.field.rel.to.app_label }}/{{ bound_field.field.rel.to.module_name }}/?{% for limit_choice in bound_field.field.rel.limit_choices_to.items %}{% if not forloop.first %}{{"&"|escape}}{% endif %}{{ limit_choice|join:"=" }}{% endfor %}" class="related-lookup" id="lookup_{{ bound_field.element_id }}" onclick="return showRelatedObjectLookupPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
     6{% else %}
    47    <a href="../../../{{ bound_field.field.rel.to.app_label }}/{{ bound_field.field.rel.to.module_name }}/" class="related-lookup" id="lookup_{{ bound_field.element_id }}" onclick="return showRelatedObjectLookupPopup(this);"> <img src="{% admin_media_prefix %}img/admin/selector-search.gif" width="16" height="16" alt="Lookup"></a>
     8{% endif %}
    59{% else %}
    610{% if bound_field.needs_add_label %}
    711    <a href="../../../{{ bound_field.field.rel.to.app_label }}/{{ bound_field.field.rel.to.module_name }}/add/" class="add-another" id="add_{{ bound_field.element_id }}" onclick="return showAddAnotherPopup(this);"> <img src="{% admin_media_prefix %}img/admin/icon_addlink.gif" width="10" height="10" alt="Add Another"/></a>
Back to Top