def undo_remove_web_user(request, domain, record_id): record = DomainRemovalRecord.get(record_id) record.undo() messages.success(request, 'You have successfully restored {username}.'.format( username=WebUser.get_by_user_id(record.user_id).username )) return HttpResponseRedirect(reverse('web_users', args=[domain]))