catalogApp.py
def addCategory():
    '''
    Adds a new category to the existing database.
    '''
    if request.method == 'POST':
        if request.form['name']:
            newCategory = Category(name=request.form['name'],
                                   img_url=request.form['img_url'],
                                   user_id=login_session['user_id'])
            session.add(newCategory)
            session.commit()
        flash("You added a new category to the catalog.")
        return redirect(url_for('showCategories',
                                login_session=login_session))
    else:
        return render_template('newcategory.html',
                               login_session=login_session)

    Adds a new category to the existing database.
    
Adds a new category to the existing database.
Adds a new category to the existing database .
def addCategory():
    if request.method == 'POST':
        if request.form['name']:
            newCategory = Category(name=request.form['name'],
                                   img_url=request.form['img_url'],
                                   user_id=login_session['user_id'])
            session.add(newCategory)
            session.commit()
        flash("You added a new category to the catalog.")
        return redirect(url_for('showCategories',
                                login_session=login_session))
    else:
        return render_template('newcategory.html',
                               login_session=login_session)
def addCategory ( ) : if request . method == 'POST' : if request . form [ 'name' ] : newCategory = Category ( name = request . form [ 'name' ] , img_url = request . form [ 'img_url' ] , user_id = login_session [ 'user_id' ] ) session . add ( newCategory ) session . commit ( ) flash ( "You added a new category to the catalog." ) return redirect ( url_for ( 'showCategories' , login_session = login_session ) ) else : return render_template ( 'newcategory.html' , login_session = login_session )
Adds a new category to the existing database.
Adds a new category to the existing database .
'''
    Adds a new category to the existing database.
    '''