mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
magic-removal: Fixed #1307 -- API changes in admin views. Thanks, mookai
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2220 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
a9db2c18c0
commit
b78f2a9827
@ -210,7 +210,7 @@ def add_stage(request, app_label, model_name, show_delete=False, form_url='', po
|
|||||||
# Here, we distinguish between different save types by checking for
|
# Here, we distinguish between different save types by checking for
|
||||||
# the presence of keys in request.POST.
|
# the presence of keys in request.POST.
|
||||||
if request.POST.has_key("_continue"):
|
if request.POST.has_key("_continue"):
|
||||||
request.user.message_set.add(msg + ' ' + _("You may edit it again below."))
|
request.user.message_set.add(message=msg + ' ' + _("You may edit it again below."))
|
||||||
if request.POST.has_key("_popup"):
|
if request.POST.has_key("_popup"):
|
||||||
post_url_continue += "?_popup=1"
|
post_url_continue += "?_popup=1"
|
||||||
return HttpResponseRedirect(post_url_continue % pk_value)
|
return HttpResponseRedirect(post_url_continue % pk_value)
|
||||||
@ -218,10 +218,10 @@ def add_stage(request, app_label, model_name, show_delete=False, form_url='', po
|
|||||||
return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
|
return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \
|
||||||
(pk_value, repr(new_object).replace('"', '\\"')))
|
(pk_value, repr(new_object).replace('"', '\\"')))
|
||||||
elif request.POST.has_key("_addanother"):
|
elif request.POST.has_key("_addanother"):
|
||||||
request.user.add_message(msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
|
request.user.message_set.add(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
|
||||||
return HttpResponseRedirect(request.path)
|
return HttpResponseRedirect(request.path)
|
||||||
else:
|
else:
|
||||||
request.user.add_message(msg)
|
request.user.message_set.add(message=msg)
|
||||||
return HttpResponseRedirect(post_url)
|
return HttpResponseRedirect(post_url)
|
||||||
else:
|
else:
|
||||||
# Add default data.
|
# Add default data.
|
||||||
@ -293,19 +293,19 @@ def change_stage(request, app_label, model_name, object_id):
|
|||||||
|
|
||||||
msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': opts.verbose_name, 'obj': new_object}
|
msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': opts.verbose_name, 'obj': new_object}
|
||||||
if request.POST.has_key("_continue"):
|
if request.POST.has_key("_continue"):
|
||||||
request.user.add_message(msg + ' ' + _("You may edit it again below."))
|
request.user.message_set.add(message=msg + ' ' + _("You may edit it again below."))
|
||||||
if request.REQUEST.has_key('_popup'):
|
if request.REQUEST.has_key('_popup'):
|
||||||
return HttpResponseRedirect(request.path + "?_popup=1")
|
return HttpResponseRedirect(request.path + "?_popup=1")
|
||||||
else:
|
else:
|
||||||
return HttpResponseRedirect(request.path)
|
return HttpResponseRedirect(request.path)
|
||||||
elif request.POST.has_key("_saveasnew"):
|
elif request.POST.has_key("_saveasnew"):
|
||||||
request.user.add_message(_('The %(name)s "%(obj)s" was added successfully. You may edit it again below.') % {'name': opts.verbose_name, 'obj': new_object})
|
request.user.message_set.add(message=_('The %(name)s "%(obj)s" was added successfully. You may edit it again below.') % {'name': opts.verbose_name, 'obj': new_object})
|
||||||
return HttpResponseRedirect("../%s/" % pk_value)
|
return HttpResponseRedirect("../%s/" % pk_value)
|
||||||
elif request.POST.has_key("_addanother"):
|
elif request.POST.has_key("_addanother"):
|
||||||
request.user.add_message(msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
|
request.user.message_set.add(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))
|
||||||
return HttpResponseRedirect("../add/")
|
return HttpResponseRedirect("../add/")
|
||||||
else:
|
else:
|
||||||
request.user.add_message(msg)
|
request.user.message_set.add(message=msg)
|
||||||
return HttpResponseRedirect("../")
|
return HttpResponseRedirect("../")
|
||||||
else:
|
else:
|
||||||
# Populate new_data with a "flattened" version of the current data.
|
# Populate new_data with a "flattened" version of the current data.
|
||||||
@ -452,7 +452,7 @@ def delete_stage(request, app_label, model_name, object_id):
|
|||||||
obj_display = str(obj)
|
obj_display = str(obj)
|
||||||
obj.delete()
|
obj.delete()
|
||||||
LogEntry.objects.log_action(request.user.id, opts.get_content_type_id(), object_id, obj_display, DELETION)
|
LogEntry.objects.log_action(request.user.id, opts.get_content_type_id(), object_id, obj_display, DELETION)
|
||||||
request.user.message_set.add(_('The %(name)s "%(obj)s" was deleted successfully.') % {'name': opts.verbose_name, 'obj': obj_display})
|
request.user.message_set.add(message=_('The %(name)s "%(obj)s" was deleted successfully.') % {'name': opts.verbose_name, 'obj': obj_display})
|
||||||
return HttpResponseRedirect("../../")
|
return HttpResponseRedirect("../../")
|
||||||
return render_to_response('admin/delete_confirmation', {
|
return render_to_response('admin/delete_confirmation', {
|
||||||
"title": _("Are you sure?"),
|
"title": _("Are you sure?"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user