-
Notifications
You must be signed in to change notification settings - Fork 0
/
Record.py
33 lines (24 loc) · 1 KB
/
Record.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from db import store_collec
class Record:
def __init__(self, username, password, website, id=None, search_value=None):
self.username = username
self.password = password
self.website = website
self.collection = store_collec
self.search_value = search_value
self._id = id
def save(self):
self.collection.insert({"username": self.username,
"password": self.password,
"website": self.website})
print("Saved !!")
def delete(self):
self.collection.remove({"username": self.username})
print("Deleted !!")
def update(self):
self.collection.update_one({"website": self.website}, {"$set": {"username": self.username,
"password": self.password}})
print("Updated !!")
def search(self):
result = self.collection.find({"website": self.search_value})
return result