Skip to content

Instantly share code, notes, and snippets.

@Athira2199
Last active February 15, 2021 10:15
Show Gist options
  • Save Athira2199/2a2d3eab5aa24197ca61b5d7955d804d to your computer and use it in GitHub Desktop.
Save Athira2199/2a2d3eab5aa24197ca61b5d7955d804d to your computer and use it in GitHub Desktop.
#handler to handle the insert operation
def insert_handler():
print('--------ADDING A NEW TO DO--------')
print('Insert name of to-do')
name = input()
print('Insert description of todo')
description = input()
insertStatus = insert_todo({
"name" : name,
"description" : description,
"status" : "pending"
})
if(not insertStatus):
print("Operation Failed")
else:
print("Operation Success")
show_handler()
#handler to input individual todo to db.
def insert_todo(newToDo):
try:
todoId = todo.insert_one(newToDo).inserted_id
return True
except:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment