def create_list(title, date, user_id): # Use CreateList procedure cursor.callproc("CreateList", ( title, date, user_id, )) db_connection.commit()
def create_event(title, event_time, user_id): # use CreateEvent stored protocol cursor.callproc("CreateEvent", ( title, event_time, user_id, )) db_connection.commit()
def create_task(title, date, description, list_id): # use CreateTask procedure cursor.callproc("CreateTask", ( title, date, description, list_id, )) db_connection.commit()
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()
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)
def delete_list(list_id): cursor.execute(" UPDATE Lists SET Deleted = NOW() WHERE ListId = %s ", (list_id, )) db_connection.commit()