Last active
February 15, 2021 10:15
-
-
Save Athira2199/2a2d3eab5aa24197ca61b5d7955d804d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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