(request, pk)
return HttpResponse(added)
Star or unstar report for user
Star or unstar report for user
Star or unstar report for user
def ajax_add_star(request, pk):
    """ Star or unstar report for user
    """
    report = get_object_or_404(Report, pk=pk)
    user = request.user
    if user in report.starred.all():
        added = False
        report.starred.remove(request.user)
    else:
        added = True
        report.starred.add(request.user)
    return HttpResponse(added)
def ajax_add_star ( request , pk ) : report = get_object_or_404 ( Report , pk = pk ) user = request . user if user in report . starred . all ( ) : added = False report . starred . remove ( request . user ) else : added = True report . starred . add ( request . user ) return HttpResponse ( added )