def admin(request): msg = '' if request.method == 'POST': action = request.POST.get('action') log_msg = '[admin] %s by %s (id: %d)' if action == 'setup_mapping': msg = 'setup_mapping triggered' log.info(log_msg % (msg, request.user, request.user.pk)) setup_mapping() elif action == 'index_all': msg = 'index_all triggered' log.info(log_msg % (msg , request.user, request.user.pk)) index_all() else: log.warning('[TAMPERING][admin] Action "%s" tried by %s (id: %s)' % (action, request.user, request.user.pk)) return render_to_response('admin.html', { 'message': msg }, context_instance=RequestContext(request))
def setup_class(cls): super(MappedESTestCase, cls).setup_class() setup_mapping()