magic-removal: Merged to [2420]
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2421 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
bc8547aa9d
commit
05bc38b2b4
|
@ -3,7 +3,13 @@
|
|||
|
||||
function showRelatedObjectLookupPopup(triggeringLink) {
|
||||
var name = triggeringLink.id.replace(/^lookup_/, '');
|
||||
var win = window.open(triggeringLink.href + '?pop=1', name, 'height=500,width=740,resizable=yes,scrollbars=yes');
|
||||
var href
|
||||
if (triggeringLink.href.search(/\?/) >= 0) {
|
||||
href = triggeringLink.href + '&pop=1';
|
||||
} else {
|
||||
href = triggeringLink.href + '?pop=1'
|
||||
}
|
||||
var win = window.open(href, name, 'height=500,width=740,resizable=yes,scrollbars=yes');
|
||||
win.focus();
|
||||
return false;
|
||||
}
|
||||
|
@ -29,12 +35,20 @@ function showAddAnotherPopup(triggeringLink) {
|
|||
function dismissAddAnotherPopup(win, newId, newRepr) {
|
||||
var name = win.name.replace(/___/g, '.')
|
||||
var elem = document.getElementById(name);
|
||||
if (elem.nodeName == 'SELECT') {
|
||||
if (elem) {
|
||||
if (elem.nodeName == 'SELECT') {
|
||||
var o = new Option(newRepr, newId);
|
||||
elem.options[elem.options.length] = o
|
||||
elem.selectedIndex = elem.length - 1;
|
||||
} else if (elem.nodeName == 'INPUT') {
|
||||
elem.value = newId;
|
||||
}
|
||||
} else {
|
||||
var toId = name + "_to";
|
||||
elem = document.getElementById(toId);
|
||||
var o = new Option(newRepr, newId);
|
||||
elem.options[elem.options.length] = o
|
||||
elem.selectedIndex = elem.length - 1;
|
||||
} else if (elem.nodeName == 'INPUT') {
|
||||
elem.value = newId;
|
||||
SelectBox.add_to_cache(toId, o);
|
||||
SelectBox.redisplay(toId);
|
||||
}
|
||||
win.close();
|
||||
}
|
||||
|
|
|
@ -16,6 +16,10 @@
|
|||
<div id="content-main">
|
||||
<h1>{{ summary }}</h1>
|
||||
|
||||
{% if description %}
|
||||
<p>{% filter escape|linebreaksbr %}{% trans description %}{% endfilter %}</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="module">
|
||||
<table class="model">
|
||||
<thead>
|
||||
|
|
|
@ -1,7 +1,11 @@
|
|||
{% load admin_modify adminmedia %}
|
||||
{% output_all bound_field.form_fields %}
|
||||
{% if bound_field.raw_id_admin %}
|
||||
<a href="{{ bound_field.related_url }}" 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>
|
||||
{% if bound_field.field.rel.limit_choices_to %}
|
||||
<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 %}&{% 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>
|
||||
{% else %}
|
||||
<a href="{{ bound_field.related_url }}" 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>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% if bound_field.needs_add_label %}
|
||||
<a href="{{ bound_field.related_url }}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>
|
||||
|
|
|
@ -191,6 +191,7 @@ def model_detail(request, app_label, model_name):
|
|||
return render_to_response('admin_doc/model_detail', {
|
||||
'name': '%s.%s' % (opts.app_label, opts.object_name),
|
||||
'summary': "Fields on %s objects" % opts.object_name,
|
||||
'description': model.__doc__,
|
||||
'fields': fields,
|
||||
}, context_instance=RequestContext(request))
|
||||
model_detail = staff_member_required(model_detail)
|
||||
|
|
|
@ -255,7 +255,7 @@ def add_stage(request, app_label, model_name, show_delete=False, form_url='', po
|
|||
return HttpResponseRedirect(post_url_continue % pk_value)
|
||||
if request.POST.has_key("_popup"):
|
||||
return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
|
||||
(pk_value, repr(new_object).replace('"', '\\"')))
|
||||
(pk_value, str(new_object).replace('"', '\\"')))
|
||||
elif request.POST.has_key("_addanother"):
|
||||
request.user.message_set.add(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
|
||||
return HttpResponseRedirect(request.path)
|
||||
|
|
|
@ -349,11 +349,11 @@ TECHNICAL_500_TEMPLATE = """
|
|||
{% if frame.context_line %}
|
||||
<div class="context" id="c{{ frame.id }}">
|
||||
{% if frame.pre_context %}
|
||||
<ol start="{{ frame.pre_context_lineno }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
|
||||
<ol start="{{ frame.pre_context_lineno|add:"1" }}" class="pre-context" id="pre{{ frame.id }}">{% for line in frame.pre_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
|
||||
{% endif %}
|
||||
<ol start="{{ frame.lineno }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol>
|
||||
<ol start="{{ frame.lineno|add:"1" }}" class="context-line"><li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ frame.context_line|escape }} <span>...</span></li></ol>
|
||||
{% if frame.post_context %}
|
||||
<ol start='{{ frame.lineno|add:"1" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
|
||||
<ol start='{{ frame.lineno|add:"2" }}' class="post-context" id="post{{ frame.id }}">{% for line in frame.post_context %}<li onclick="toggle('pre{{ frame.id }}', 'post{{ frame.id }}')">{{ line|escape }}</li>{% endfor %}</ol>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
Loading…
Reference in New Issue