(u, p, cid)
return render_template('delete_channel.html',
        project=c.project,
        channel=c
    )
Delete an existing service hook.
Delete an existing service hook.
Delete an existing service hook .
def delete_channel(u, p, cid):
    """
    Delete an existing service hook.
    """
    c = Channel.query.filter_by(
        id=cid,
        project_id=p.id
    ).first()

    if not c:
        # Project or channel doesn't exist (404 Not Found)
        return abort(404)

    if c.project.owner.id != g.user.id or c.project.id != p.id:
        # Project isn't public and the viewer isn't the project owner.
        # (403 Forbidden)
        return abort(403)

    if request.method == 'POST' and request.form.get('do') == 'd':
        c.project.channels.remove(c)
        db.session.delete(c)
        db.session.commit()
        return redirect(url_for('.details', p=p.name, u=u.username))

    return render_template('delete_channel.html',
        project=c.project,
        channel=c
    )
def delete_channel ( u , p , cid ) : c = Channel . query . filter_by ( id = cid , project_id = p . id ) . first ( ) if not c : # Project or channel doesn't exist (404 Not Found) return abort ( 404 ) if c . project . owner . id != g . user . id or c . project . id != p . id : # Project isn't public and the viewer isn't the project owner. # (403 Forbidden) return abort ( 403 ) if request . method == 'POST' and request . form . get ( 'do' ) == 'd' : c . project . channels . remove ( c ) db . session . delete ( c ) db . session . commit ( ) return redirect ( url_for ( '.details' , p = p . name , u = u . username ) ) return render_template ( 'delete_channel.html' , project = c . project , channel = c )