Ticket #7982: ticket7982against8487.diff
File ticket7982against8487.diff, 4.6 KB (added by , 16 years ago) |
---|
-
django/contrib/admin/options.py
180 180 def __call__(self, request, url): 181 181 # Delegate to the appropriate method, based on the URL. 182 182 if url is None: 183 return self.changelist_view(request) 183 return HttpResponseRedirect("objects/") 184 elif url.startswith('objects'): 185 if url.endswith('objects'): 186 return self.changelist_view(request) 187 elif len(url.split("/")) == 3 and url.endswith('history'): 188 return self.history_view(request, unquote(url[8:-8])) 189 elif len(url.split("/")) == 3 and url.endswith('delete'): 190 return self.delete_view(request, unquote(url[8:-7])) 191 else: 192 return self.change_view(request, unquote(url[8:])) 184 193 elif url.endswith('add'): 185 194 return self.add_view(request) 186 elif url.endswith('history'):187 return self.history_view(request, unquote(url[:-8]))188 elif url.endswith('delete'):189 return self.delete_view(request, unquote(url[:-7]))190 195 else: 191 return self.change_view(request, unquote(url))196 return Http404("There is currently no view assigned to that address") #TODO: Replace me with something better 192 197 198 193 199 def _media(self): 194 200 from django.conf import settings 195 201 … … 398 404 "admin/change_form.html" 399 405 ], context, context_instance=template.RequestContext(request)) 400 406 401 def response_add(self, request, obj, post_url_continue='../ %s/'):407 def response_add(self, request, obj, post_url_continue='../objects/%s/'): 402 408 """ 403 409 Determines the HttpResponse for the add_view stage. 404 410 """ … … 409 415 # Here, we distinguish between different save types by checking for 410 416 # the presence of keys in request.POST. 411 417 if request.POST.has_key("_continue"): 418 print pk_value 419 print escape(pk_value) 420 print force_unicode(pk_value) 412 421 self.message_user(request, msg + ' ' + _("You may edit it again below.")) 413 422 if request.POST.has_key("_popup"): 414 423 post_url_continue += "?_popup=1" 415 return HttpResponseRedirect(post_url_continue % pk_value)424 return HttpResponseRedirect(post_url_continue % escape(pk_value)) 416 425 417 426 if request.POST.has_key("_popup"): 418 427 return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, "%s", "%s");</script>' % \ … … 420 429 (escape(pk_value), escape(obj))) 421 430 elif request.POST.has_key("_addanother"): 422 431 self.message_user(request, msg + ' ' + (_("You may add another %s below.") % force_unicode(opts.verbose_name))) 423 return HttpResponseRedirect(request.path) 432 return HttpResponseRedirect(request.path) #TODO: Fix this when save and add from an existing object 424 433 else: 425 434 self.message_user(request, msg) 426 435 -
django/contrib/admin/templates/admin/change_list.html
5 5 6 6 {% block bodyclass %}change-list{% endblock %} 7 7 8 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../ ">{% trans "Home" %}</a> › <a href="../">{{ app_label|capfirst|escape }}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }}</div>{% endblock %}{% endif %}8 {% if not is_popup %}{% block breadcrumbs %}<div class="breadcrumbs"><a href="../../../">{% trans "Home" %}</a> › <a href="../../">{{ app_label|capfirst|escape }}</a> › {{ cl.opts.verbose_name_plural|capfirst|escape }} </div>{% endblock %}{% endif %} 9 9 10 10 {% block coltype %}flex{% endblock %} 11 11 … … 13 13 <div id="content-main"> 14 14 {% block object-tools %} 15 15 {% if has_add_permission %} 16 <ul class="object-tools"><li><a href=" add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul>16 <ul class="object-tools"><li><a href="../add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name|escape as name %}Add {{ name }}{% endblocktrans %}</a></li></ul> 17 17 {% endif %} 18 18 {% endblock %} 19 19 <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">