diff options
Diffstat (limited to '97suifangqa/apps/indicator/views.py')
-rw-r--r-- | 97suifangqa/apps/indicator/views.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/97suifangqa/apps/indicator/views.py b/97suifangqa/apps/indicator/views.py index 8d46537..d317277 100644 --- a/97suifangqa/apps/indicator/views.py +++ b/97suifangqa/apps/indicator/views.py @@ -1174,6 +1174,35 @@ def ajax_close_sub_title(request): # }}} +# ajax_delete_record {{{ +@login_required +def ajax_delete_record(request): + """ + delete the specified record + """ + result = 'failed' + if request.is_ajax() and request.method == 'GET': + record_id = request.GET.get('record_id') + # get record object + try: + record_id = int(record_id) + record_obj = get_object_or_404(im.IndicatorRecord, + id=record_id) + record_obj.delete() + result = 'success' + except ValueError: + print u'Error: record_id="%s" cannot convert to integer'\ + % record_id + result = 'failed' + except: + print u'Error: unknwon error' + result = 'failed' + + # + return HttpResponse(result) +# }}} + + # ajax_get_card_data_chart {{{ @login_required def ajax_get_card_data_chart(request): @@ -1538,6 +1567,7 @@ def ajax_search_indicators(request): return HttpResponse(json.dumps(data), mimetype='application/json') # }}} + # ajax_unfollow_indicator {{{ @login_required def ajax_unfollow_indicator(request): |