Example #1
0
def add_tag():

    form = AddTagForm()
    if form.validate_on_submit():
        tag = request.form['tag']
        functions.add_tag(tag, session['id'])
        return redirect('/profile/')
    return render_template('add_tag.html', form=form, username=session['username'])
Example #2
0
def add_tag():
    '''
        App for adding a tag
    '''
    form = AddTagForm()
    if form.validate_on_submit():
        tag = request.form['tag']
        functions.add_tag(tag, session['id'])
        return redirect('/view_notes/')
    return render_template('add_tag.html', form=form, username=session['username'])
def add_tag():
    '''
        App for adding a tag
    '''
    form = AddTagForm()
    if form.validate_on_submit():
        tag = request.form['tag']
        tags = functions.get_all_tags(session['id'])
        res = list(zip(*tags))
        res = set(res[1])
        if tag in res:

            flash("Tag Already Exists", 'alert alert-danger')
            return render_template('add_tag.html',
                                   form=form,
                                   username=session['username'])

        else:
            functions.add_tag(tag, session['id'])
            return redirect('/profile/')
    return render_template('add_tag.html',
                           form=form,
                           username=session['username'])