@login_required
def delete_favorite(req, id):
 try:
  favorite = models.Favorite.objects.get(user=req.user, pk=id)
  favorite.delete()
 except ObjectDoesNotExist:
  pass
 response = {'has_favorite': 'false'}
 return HttpResponse(json.dumps(response), content_type='application/json', status=200)

@ login_required def delete_favorite ( req , id ) : try : favorite = models . Favorite . objects . get ( user = req . user , pk = id ) favorite . delete ( ) except ObjectDoesNotExist : pass response = { 'has_favorite' : 'false' } return HttpResponse ( json . dumps ( response ) , content_type = 'application/json' , status = 200 )
delete favorite and put favorite_info object in response .