示例#1
0
def create_list(title, date, user_id):
    # Use CreateList procedure
    cursor.callproc("CreateList", (
        title,
        date,
        user_id,
    ))
    db_connection.commit()
示例#2
0
def create_event(title, event_time, user_id):
    # use CreateEvent stored protocol
    cursor.callproc("CreateEvent", (
        title,
        event_time,
        user_id,
    ))
    db_connection.commit()
示例#3
0
def create_task(title, date, description, list_id):
    # use CreateTask procedure
    cursor.callproc("CreateTask", (
        title,
        date,
        description,
        list_id,
    ))
    db_connection.commit()
示例#4
0
def update_list(title, date, list_id):
    cursor.execute(
        """ UPDATE CalendarItems
                    JOIN Lists on Lists.CalendarItem = CalendarItems.ItemId
                    SET Title = %s, Date = %s
                    WHERE Lists.ListId = %s
                    """, (
            title,
            date,
            list_id,
        ))
    db_connection.commit()
示例#5
0
def register():
    if current_user.is_authenticated:
        return redirect(url_for('home'))
    form = RegistrationForm()
    if form.validate_on_submit():
        hashed_password = bcrypt.generate_password_hash(
            form.password.data).decode('utf-8')
        db_cursor.execute(
            "INSERT INTO Users(Username, Email, Password) VALUES (%s, %s, %s)",
            (form.username.data, form.email.data, hashed_password))
        db_connection.commit()
        flash('Your account has been created!', 'success')
        return redirect(url_for('home'))
    return render_template('register.html', title='Register', form=form)
示例#6
0
def delete_list(list_id):
    cursor.execute(" UPDATE Lists SET Deleted = NOW() WHERE ListId = %s ",
                   (list_id, ))
    db_connection.commit()