Exemplo n.º 1
0
def del_jobpost_fb(user, post):
    user = User.objects.filter(id=user).first()
    if user:
        try:
            graph = GraphAPI(Facebook.objects.get(user=user).accesstoken)
            post = FacebookPost.objects.filter(id=post).first()
            post.post_status = "Deleted"
            post.save()
            graph.delete_object(post.post_id)
        except:
            print("not deleted")
        return "deleted successfully"
    return "connect to fb"
Exemplo n.º 2
0
def del_jobpost_peel_fb(user, post):
    user = User.objects.filter(id=user).first()
    if user:
        try:
            graph = GraphAPI(settings.REC_FB_ACCESS_TOKEN)
            post = FacebookPost.objects.filter(id=post).first()
            post.post_status = "Deleted"
            post.save()
            graph.delete_object(post.post_id)
        except:
            print("not deleted")
        return "deleted successfully"
    return "connect to fb"