"""
Created on Jan 22, 2015

@author: noob
"""

from common.models import CustomUserReport
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseNotAllowed


@login_required
def delete_custom_report(request):
    if request.method != 'POST':
        return HttpResponseNotAllowed('only POST is allowed')
    user = request.user
    cur_id = request.GET.get('id', '')
    cur = CustomUserReport.objects.get(n=cur_id)
    if cur.user == user.username:
        cur.active = False
        cur.save()
    return HttpResponse()
