Ticket #1307: patch.diff
File patch.diff, 4.4 KB (added by , 19 years ago) |
---|
-
models.py
9 9 10 10 class LogEntryManager(models.Manager): 11 11 def log_action(self, user_id, content_type_id, object_id, object_repr, action_flag, change_message=''): 12 e = self. klass(None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message)12 e = self.model(None, None, user_id, content_type_id, object_id, object_repr[:200], action_flag, change_message) 13 13 e.save() 14 14 15 15 class LogEntry(models.Model): -
views/main.py
210 210 # Here, we distinguish between different save types by checking for 211 211 # the presence of keys in request.POST. 212 212 if request.POST.has_key("_continue"): 213 request.user. add_message(msg + ' ' + _("You may edit it again below."))213 request.user.message_set.add(message=msg + ' ' + _("You may edit it again below.")) 214 214 if request.POST.has_key("_popup"): 215 215 post_url_continue += "?_popup=1" 216 216 return HttpResponseRedirect(post_url_continue % pk_value) … … 218 218 return HttpResponse('<script type="text/javascript">opener.dismissAddAnotherPopup(window, %s, "%s");</script>' % \ 219 219 (pk_value, repr(new_object).replace('"', '\\"'))) 220 220 elif request.POST.has_key("_addanother"): 221 request.user. add_message(msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))221 request.user.message_set.add(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 222 222 return HttpResponseRedirect(request.path) 223 223 else: 224 request.user. add_message(msg)224 request.user.message_set.add(message=msg) 225 225 return HttpResponseRedirect(post_url) 226 226 else: 227 227 # Add default data. … … 293 293 294 294 msg = _('The %(name)s "%(obj)s" was changed successfully.') % {'name': opts.verbose_name, 'obj': new_object} 295 295 if request.POST.has_key("_continue"): 296 request.user. add_message(msg + ' ' + _("You may edit it again below."))296 request.user.message_set.add(message=msg + ' ' + _("You may edit it again below.")) 297 297 if request.REQUEST.has_key('_popup'): 298 298 return HttpResponseRedirect(request.path + "?_popup=1") 299 299 else: 300 300 return HttpResponseRedirect(request.path) 301 301 elif request.POST.has_key("_saveasnew"): 302 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})302 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}) 303 303 return HttpResponseRedirect("../%s/" % pk_value) 304 304 elif request.POST.has_key("_addanother"): 305 request.user. add_message(msg + ' ' + (_("You may add another %s below.") % opts.verbose_name))305 request.user.message_set.add(message=msg + ' ' + (_("You may add another %s below.") % opts.verbose_name)) 306 306 return HttpResponseRedirect("../add/") 307 307 else: 308 request.user. add_message(msg)308 request.user.message_set.add(message=msg) 309 309 return HttpResponseRedirect("../") 310 310 else: 311 311 # Populate new_data with a "flattened" version of the current data. … … 452 452 obj_display = str(obj) 453 453 obj.delete() 454 454 LogEntry.objects.log_action(request.user.id, opts.get_content_type_id(), object_id, obj_display, DELETION) 455 request.user. add_message(_('The %(name)s "%(obj)s" was deleted successfully.') % {'name':opts.verbose_name, 'obj':obj_display})455 request.user.message_set.add(message=_('The %(name)s "%(obj)s" was deleted successfully.') % {'name':opts.verbose_name, 'obj':obj_display}) 456 456 return HttpResponseRedirect("../../") 457 457 return render_to_response('admin/delete_confirmation', { 458 458 "title": _("Are you sure?"),